hi all, i am trying to convert the date from d/m/Y h:i A (21/12/2011 2:28 AM”) to timestamp but no success. i ve also tried strtotime but it returns false not tha timestamp. any suggestion. ?
@NogDogDec 21.2011 — #If using PHP 5.3.0+, you could look at [url=http://www.php.net/manual/en/datetime.createfromformat.php]DateTime::createFromFormat[/url]() and [url=http://www.php.net/manual/en/datetime.gettimestamp.php]DateTime::getTimestamp[/url]().
@ZABIauthorDec 21.2011 — #let me explain in detail, i have stored transaction time in a field as timestamp using PHP's time() function so that it can be displayed in different date formats. so when i want to search for records after a specific time i need to convert the time entered from a Javascript Datetime picker, and it gives me time like "21/12/2011 12:21 PM", thats what i want to convert to a timestamp and match the records in mysql query
@NogDogDec 21.2011 — #My first suggestion would be to see if the Javascript datetime picker can be configured to give a more portable format, e.g. "2011-12-21 15:21", which you could then use directly in your query (properly escaped to avoid SQL injection, of course ? ). If not, then either look at MySQL's [url=http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_str-to-date]STR_TO_DATE[/url]() function, or else see my previous reply for converting it within PHP (assuming a reasonably current version).