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
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
Share on other sites

12:20

12:10

12:00

11:50

11:40

11:30

11:20

11:10

11:00

10:50

10:40

10:30

10:20

10:10

10:00

09:50

 

 

After adding arr_reverse also

12:20

12:10

12:00

11:50

11:40

11:30

11:20

11:10

11:00

10:50

10:40

10:30

10:20

10:10

10:00

09:50

 

 

No change in the values.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.