0% found this document useful (0 votes)
14 views2 pages

Date Time

The document is an HTML page containing PHP code that demonstrates how to acquire and display date information using the getdate() function. It outputs today's date and time, creates a timestamp for a specific date, and formats dates using the date() function. The code illustrates various ways to manipulate and format date and time in PHP.

Uploaded by

laxmibengeri2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Date Time

The document is an HTML page containing PHP code that demonstrates how to acquire and display date information using the getdate() function. It outputs today's date and time, creates a timestamp for a specific date, and formats dates using the date() function. The code illustrates various ways to manipulate and format date and time in PHP.

Uploaded by

laxmibengeri2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

<html>

<head>

<title>Acquiring date information with getdate()</title>

</head>

<body>

<?php

$date_array = getdate(); // no argument passed so today’s date will be used

foreach ($date_array as $key => $val) {

echo "$key = $val<br>";

echo "Today's date: ".$date_array['mon']."/".$date_array['mday']."/".

$date_array['year']."<p>";

//Function for implementing time

$x=time();

echo “The time is:”.”$x”;

?>

// make a timestamp for Aug 23 2003 at 4.15 am

$ts = mktime(4, 15, 0, 8, 23, 2003);

echo date("m/d/y G.i:s", $ts);

echo "<br>";

echo "The date is ";

echo date("j \\of F Y, \a\\t g.i a", $ts );


//Formatting a date using date()

$time = time(); //stores the exact timestamp to use in this script

echo date("m/d/y G.i:s", $time);

echo "<br>";

echo "Today is ";

echo date("j \o\\f F Y, \a\\t g.i a", $time);

</body>

</html>

You might also like