Jump to content


Photo

timestamp


  • Please log in to reply
2 replies to this topic

#1 mikenorman

mikenorman
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 18 October 2005 - 09:16 AM

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

#2 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 18 October 2005 - 03:30 PM

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

both would work
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 18 October 2005 - 05:51 PM

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.
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users