Jump to content

[SOLVED] strtotime


eon201

Recommended Posts

lol. sorry

so date in the array is in this format yyyy-mm-dd

whilst time is in this format hh:mm:ss

 

$time = $overall_array['time'];

$date = $overall_array['date'];

$date = $date. " ". $time;

$date = substr_replace($date, " ", 4, 1);

$date = substr_replace($date, " ", 7, 1);

 

$date = '2007 11 11 20:34:56';

 

Hope that helps clear things up!

Link to comment
https://forums.phpfreaks.com/topic/77444-solved-strtotime/#findComment-392044
Share on other sites

MySQL has a unix_timestamp() function that will convert a MySQL datetime format to a unix_timestamp like this...

 


$query = mysql_query ("SELECT unix_timestamp('2007-11-15 12:00:00') AS timestamp");
$date = mysql_fetch_assoc ($query);
echo $date['timestamp'];

 

The parameter of the function can also be a database field like this...

 


$query = mysql_query ("SELECT unix_timestamp(date) AS timestamp");
$date = mysql_fetch_assoc ($query);
echo $date['timestamp'];

Link to comment
https://forums.phpfreaks.com/topic/77444-solved-strtotime/#findComment-392049
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.