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.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
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
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 STR_TO_DATE() function, or else see my previous reply for converting it within PHP (assuming a reasonably current version).
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks