homepage Welcome to WebmasterWorld Guest from 54.227.141.101
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
convert dates in Unix time format
ktsirig




msg:3249133
 10:10 am on Feb 11, 2007 (gmt 0)

Hello all,
I have around 900 dates in the format of DD-MM-YYYY and I want to convert them in Unix time format...
Is there a way to do this? I was thinking of passing them into an array, and then, for each date, I would use the function date() I suppose and get the Unix time format of them... But I don't know the way to do it...

So, for instance, if you have:
$date_to_format='05-10-2006' , how would I get the Unix timestamp?

Thank you in advance!

 

dreamcatcher




msg:3249194
 1:08 pm on Feb 11, 2007 (gmt 0)

Hi ktsirig,

I think the strtotime [uk.php.net] function is what you are looking for.

dc

scriptmasterdel




msg:3249196
 1:10 pm on Feb 11, 2007 (gmt 0)

You should be able to use the mysql function UNIX_TIMESTAMP;

And do a simple update.

UPDATE myTable set myDate = UNIX_TIMESTAMP(myDate);

PLEASE NOTE: This is untested code, i suggest you backup everythin before you try any of my code =)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved