mikenorman Posted October 18, 2005 Share Posted October 18, 2005 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 Link to comment https://forums.phpfreaks.com/topic/2687-timestamp/ Share on other sites More sharing options...
ryanlwh Posted October 18, 2005 Share Posted October 18, 2005 php function: strtotime('10/18/2005') mysql function: str_to_date('10/18/2005','%m/%d/%Y') both would work Link to comment https://forums.phpfreaks.com/topic/2687-timestamp/#findComment-8935 Share on other sites More sharing options...
AndyB Posted October 18, 2005 Share Posted October 18, 2005 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. Link to comment https://forums.phpfreaks.com/topic/2687-timestamp/#findComment-8942 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.