Raised This Month: $12 Target: $400
 3% 

Unix Time convert


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
graczu
Senior Member
Join Date: Mar 2006
Old 05-06-2009 , 06:05   Unix Time convert
Reply With Quote #1

Hello i want to convert date that i chose to Unix Time (seconds elapsed since 00:00:00 on January 1, 1970.)

We have "get_systime" function but what to do i i have date: 15.05.12009 15:50:00 and i want it to convert into unix time.

I want to do something like http://us2.php.net/manual/pl/function.mktime.php this function in PHP?.

Any idea how to?.
__________________
graczu is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-06-2009 , 11:37   Re: Unix Time convert
Reply With Quote #2

I will write it for you
__________________
Bugsy is offline
graczu
Senior Member
Join Date: Mar 2006
Old 05-06-2009 , 16:44   Re: Unix Time convert
Reply With Quote #3

Maybe it is a idea for amxmodx dev team to add something like this.

@Bugsy i will be glad ;-)
__________________
graczu is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-06-2009 , 20:11   Re: Unix Time convert
Reply With Quote #4

http://amxmodx.org/funcwiki.php?go=func&id=250
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-07-2009 , 01:23   Re: Unix Time convert
Reply With Quote #5

Thanks YamiKaitou. I didn't know format_time() could take a unix time and format it accordingly. I didn't have a chance to see your reply before writing out the code @ work in notepad; I wrote code to both convert unix time -> normal time and also normal time -> unix time. I may post it in the code snippets forum just in case anyone else could use it.

Here's some examples for how to use it graczu if you are not sure:
PHP Code:
format_timeszTime 64 "%m/%d/%Y - %I:%M:%S %p" 1234567890 );
server_printszTime );

format_timeszTime 64 "%m/%d/%Y - %I:%M:%S %p" 1094321233);
server_printszTime ); 
Code:
02/13/2009 - 06:31:30 PM

09/04/2004 - 02:07:13 PM
__________________

Last edited by Bugsy; 05-07-2009 at 01:39.
Bugsy is offline
graczu
Senior Member
Join Date: Mar 2006
Old 05-07-2009 , 04:36   Re: Unix Time convert
Reply With Quote #6

No no no, i want date convert to unixtime. Not Unix Time to Date.

Like here: http://us2.php.net/manual/pl/function.mktime.php ;-)

I know that there is format_time function, but it converting unixtime to date. And it don't help me.
__________________
graczu is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-07-2009 , 11:22   Re: Unix Time convert
Reply With Quote #7

Here's the link to the include file:

http://forums.alliedmods.net/showthread.php?t=91915
__________________
Bugsy is offline
graczu
Senior Member
Join Date: Mar 2006
Old 05-07-2009 , 13:06   Re: Unix Time convert
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
Here's the link to the include file:

http://forums.alliedmods.net/showthread.php?t=91915
Big THX
__________________
graczu is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode