Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Apr 2006
    Location
    Northbrook, IL
    Posts
    394
    Thanks
    8
    Thanked 6 Times in 6 Posts

    Question JS<=>PHP5<=>MySQL5 best way to pass DATE/TIME?

    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
    Last edited by Leeoniya; 12-17-2007 at 03:18 AM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •