Easy Web Programming With PHP plus HTML 5 - part 4. How to Working with Date and Time

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

SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 komentar:

Posting Komentar