...

View Full Version : JS<=>PHP5<=>MySQL5 best way to pass DATE/TIME?



Leeoniya
12-17-2007, 03:55 AM
With so many date/time functions in all 3 languages. What's the best/easiest way to pass Date/Time between all 3. for my current application i dont need resolution or accuracy greater than 1 second. I dont need to have dates prior to 1970. Also i need an easy method to format the date in a user-friendly format.

Date.parse()/1000 seems to get good results in JS.

in MySQL, there's FROM_UNIXTIME and DATE_FORMAT functions and DATETIME and TIMESTAMP formats, with the former having more uniform and predictable behavior between different versions and a much broader range support, so i would prefer to use DATETIME if possible for DB storage

in contrast php has strtotime() and seems to exclusively deal with unix style timestamps.

mods, sorry for cross-posting, but this really does cover all 3 sections.

thanks,
Leon



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum