Date:
PHP date function return current date of server with the requested date format.
syntax:
1 |
string date ( string $format [, int $timestamp = time() ] ) |
The return format is string.
$format - Mandatory and data type is string.
$timestamp - Optional and data type is integer, time() is the default value.
Time:
Time function return current unix timestamp.
1 |
int time ( void ) |
Example For UTC Timezone
1 2 3 4 5 6 7 8 9 10 11 |
<?php date_default_timezone_set("UTC"); $today_date = date("d F Y - h:i A"); $tomorrow_date = date("d F Y - h:i A", time() + (24 * 60 * 60)); // 1 day = 24 * 60 * 60 echo "Today Date: ", $today_date, "<br />", "Tomorrow Date: ", $tomorrow_date; ?> |
Click the below button to see the demo.
Demo for UTC Timezone
Example For India Timezone
1 2 3 4 5 6 7 8 9 10 11 |
<?php date_default_timezone_set("Asia/Kolkata"); $today_date = date("d F Y - h:i A"); $tomorrow_date = date("d F Y - h:i A", time() + (24 * 60 * 60)); // 1 day = 24 * 60 * 60 echo "Today Date: ", $today_date, "<br />", "Tomorrow Date: ", $tomorrow_date; ?> |
Click the below button to see the demo.
Demo for India Timezone
Please follow and like us: