4. Working with Date and Time
In programming is also important to have the time. In PHP, time can now be obtained with the command getdate (); the one that can accommodated in a variable of type array.
While to a certain date to allocate value variable, you can use mktime command, see for example The following code:
<html>
<head>
<title> Time with PHP </ title>
</ head>
<body>
<div>
<? php
echo "<h1> Date Now </ h1>";
$ tgl_Sekarang = getdate ();
print "Now Date
: ". $ tgl_Sekarang ['mday']." <br/> "."
Now Month
: ". $ tgl_Sekarang ['mon']." <br/> "."
Now Year
: ". $ tgl_Sekarang ['year']." <br /> ";
echo "<h1> Date Artificial </ h1>";
$ waktu_buatan = mktime (2, 30, 0, 5, 1, 2010);
print "Date Made:". date ("d / m / y Gi: s", $ waktu_buatan);
?>
</ div>
</ body>
</ html>
The above code, if it is shown in the browser will look like the following.
4.1 Display Date and Time |
0 komentar:
Posting Komentar