Tomer
09-02-2005, 05:29 AM
Learn how to play and use dates with PHP.
This tutorial will teach you the basics on how to use time & date with PHP.
Ever wondered how time works on the internet, very simple actually. All times are measured by the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
The measurement is called a timestamp, which contains the large date number.
You can get the timestamp of the current time with the following function:
<?php
$timestamp = mktime();
?>
Now that we have the timestamp, we can transform it to our favorite format. For this, we'll need to use the date() function.
Lets see an example:
<?php
$timestamp = mktime();
// Lets show this format: day - month - year
echo date("d - m - Y", $timestamp);
?>
To view the rest of this tutorial, please click here (http://www.swedesignz.com/php.html?id=11).
- Tomer
This tutorial will teach you the basics on how to use time & date with PHP.
Ever wondered how time works on the internet, very simple actually. All times are measured by the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
The measurement is called a timestamp, which contains the large date number.
You can get the timestamp of the current time with the following function:
<?php
$timestamp = mktime();
?>
Now that we have the timestamp, we can transform it to our favorite format. For this, we'll need to use the date() function.
Lets see an example:
<?php
$timestamp = mktime();
// Lets show this format: day - month - year
echo date("d - m - Y", $timestamp);
?>
To view the rest of this tutorial, please click here (http://www.swedesignz.com/php.html?id=11).
- Tomer
