I have a user input where the user inputs time and date as ‘9.30am’ and ’01/02/2012′. I am trying to convert this to a unix timestamp to aid ordering when dragging the data back out of the database but strptime() is confusing me as I am unsure as to whether this is actually returning a unix timestamp that I need.
Share
Using PHP’s built-in DateTime class…
…returns a Unix timestamp.
Documentation:
PHP DateTime Class
a. DateTime::createFromFormat
b. DateTime::getTimestamp
To add your variables, use it like so…
Or…
Note: Make sure that your variables conform with the following…
$time= hh:mm (and “am” or “pm” is appended)$date= dd/mm/yyyy