Jump to content

Working with dates and times


ShopMAster

Recommended Posts

Use the strtotime() function to convert an arbitrary date/time string to a UNIX timestamp. Use the time() function to get the UNIX timestamp of the current date/time.

 

BTW, there are 3600 seconds in an hour.

 

You can get "now - 1 hour" a few different ways:

<?php
$now = time();
$lasthour = $now - 3600;
// or
$lasthour1 = strtotime("-1 hour");
// or
$lasthour2 = time() - 3600;
?>

 

Ken

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.