Jump to content

Archived

This topic is now archived and is closed to further replies.

mikenorman

timestamp

Recommended Posts

Hi,

 

In my mysql database i have a field named 'date' set as a timestamp.

Using a form i would like to retrieve records between two dates.

I am entering the dates into the form as '18/10/2005' and i need to convert this into its timestamp format so that i can compare.

Any ideas please.

many thanks

Mike Norman

Share this post


Link to post
Share on other sites

php function: strtotime('10/18/2005')

mysql function: str_to_date('10/18/2005','%m/%d/%Y')

 

both would work

Share this post


Link to post
Share on other sites

Cautionary note: I am entering dates in the .... format. But what about every other user of the form? I'd suggest user-proofing the data entry by having three date entry fields - day, month, year (dropdowns are nice and user-proof). Then it doesn't matter what date format the user thinks of using, since your form will always have the responses in the same format.

Share this post


Link to post
Share on other sites

×

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.