Jump to content

datetime or date and time?


sharkyJay

Recommended Posts

It is best to store the date and time as a unix timestamp in one field. Then when you get the timestamp out of the database you can use the date function to format the time stamp:
[code]date("d-m-y", $row['timestamp']);[/code]
Also you can easily compare dates too with timestamps.
Link to comment
Share on other sites

A lot of people like UNIX timestamps, but be careful with them because they are messy when you have dates prior to January 1 1970.

It depends on what you are going to store, but quoting Barand:

[quote]@poirot

I was born in 1949 - try storing my date of birth in a UNIX timestamp.[/quote]

This was when I realized UNIX timestamps were not magical solutions.
Link to comment
Share on other sites

Umm, thats a good point there poirot I always forget about unix timestamp will only work with dates prior to Jan 1 1970! But unix timestamp is okay for doings things such as logging when someone posts a message or logs in etc but not with DoB's
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.