Jump to content

timestamp


rashmi_k28

Recommended Posts

list($year,$month,$day,$hour,$minute,$second) = explode(':', date('2008:03:05:09:50:01'));

$minute = 10*(floor($minute/10));

$time_interval = array();
for($minutes=0; $minutes<=24*60; $minutes += 10)
{
    $ti = date('H:i', mktime($hour,$minute-$minutes));

//array_reverse($time_interval);
//array_reverse($time_interval);
array_push($time_interval,$ti);

}

//array_pop($time_interval);
for($i=0;$i<count($time_interval);$i++){
print $time_interval[$i]."\n";
}

 

I have tried the code but now I want the $time_interval array to be reversed. But the array is not reversed if I add array_reverse($time_interval);

 

Please tell me hot to reverse the array

Link to comment
https://forums.phpfreaks.com/topic/94420-timestamp/#findComment-483596
Share on other sites

Try calling the function properly then

 

$minute = 10*(floor($minute/10));

$time_interval = array();
for($minutes=0; $minutes<=24*60; $minutes += 10)
{
    $time_interval[] = date('H:i', mktime($hour,$minute-$minutes));

}
array_reverse($time_interval);
foreach($time_interval as $val){
print $val."\n";
}

Link to comment
https://forums.phpfreaks.com/topic/94420-timestamp/#findComment-483662
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.