Thursday, 25 October 2012

Time and date functions

Some of the most useful parameters are:
date("y")
Returns the current year from a date - with today's date, it returns: 12
date("m")
Returns the current month from a date - with today's date, it returns: 10
date("n")
Returns the current month from a date without leading zeroes ( eg. "1" instead of "01") - with today's date, it returns: 10
date("F")
Returns the current month name from a date - with today's date, it returns: October
date("d")
Returns the current day of the month from a date - with today's date, it returns: 25
date("l")
Returns the name of the current weekday from a date - with today's date, it returns: Thursday
date("w")
Returns the current day of the week from a date - with today's date, it returns: 4
date("H")
Returns the current hour from a time - with the current time, it returns: 11
date("i")
Returns the current minute from a time - with the current time, it returns: 42
date("s")
Returns the current second from a time - with the current time, it returns: 41
 
sample Program :
 
<html>
   <head>
 <title>time and date</title>
   </head>
 <body>

     <?php  
 
        echo mktime (2,56,0,7,21,1969);

      ?>

 </body>
</html>
 

No comments:

Post a Comment