No announcement yet.

Best way to store dates

  • Filter
  • Time
  • Show
Clear All
new posts

  • Best way to store dates

    What is the best way to store dates, generally or in mysql? I need something that I can manipulate or change at a later time, the format more or less. I was thinking that this could be done using the Unix epoch, but I am not sure how or if possible. Any suggestions?

  • #2
    I'd say PHP, Unix timestamps. You can do this by calling the PHP function, time();

    Or you can use the MySQL function, NOW(). This will store the dates in a format like this: YYYY-MM-DD HH:MM:SS. I'm not sure if that's the exact one though.

    From there, when retrieving the record, you can use the MySQL function UNIX_TIMESTAMP(...) to make it a *drumroll* Unix Timestamp.


    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.