kreut Posted March 2, 2011 Share Posted March 2, 2011 Hello! I'm working with dates in PHP for the first time and I've got a few questions. I'm using strtotime() to successfully convert my user's input (let's call her Sandy) into a specified date that they enter. My questions then are: 1) I'm going to put the strtotime() date into MySql -- are there any issues that one should be aware of (I seem to recall reading that dates can be tricky, depending on which database you use?) 2) The timestamp that I put into MySql will periodically be tested against the local time of users who live in the same timezone as Sandy, though Sandy may not live in my timezone. My question then, is whether there's a "local timestamp" function in PHP that can compare Sandy's entered timestamp, that will reside in my database, to specific users' local timestamps. Thanks so much... Link to comment https://forums.phpfreaks.com/topic/229366-nervous-about-a-first-date/ Share on other sites More sharing options...
litebearer Posted March 2, 2011 Share Posted March 2, 2011 Might take a look here... http://stackoverflow.com/questions/863474/automatically-detect-users-current-local-time-with-javascript-or-php Link to comment https://forums.phpfreaks.com/topic/229366-nervous-about-a-first-date/#findComment-1181798 Share on other sites More sharing options...
ManiacDan Posted March 2, 2011 Share Posted March 2, 2011 1) Use the DATETIME datatype, which stores the timezone if you provide one. 2) If you're running PHP5.3+ you can use the DateTime object (not to be confused with the DATETIME mysql datatype) to compare dates. -Dan Link to comment https://forums.phpfreaks.com/topic/229366-nervous-about-a-first-date/#findComment-1181822 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.