Professional Documents
Culture Documents
PHP Date Function
PHP Date Function
By Y.Sirisha 08BCE367
Syntax
date(format,timestamp) date(format,timestamp)
Format :Required. Specifies the format of the timestamp Timestamp :Optional. Specifies a timestamp. Default is the current date and time
Example
<?php echo date("Y/m/d") . "<br />"; echo date("Y.m.d") . "<br />"; echo date("Y-m-d") date("Y?> Output 2009/05/11 2009.05.11 2009-052009-05-11
Example
<?php print_r(getdate()); ?> Output Array ( [seconds] => 45 [minutes] => 52 [hours] => 14 [mday] => 24 [wday] => 2 [mon] => 1 [year] => 2006 [yday] => 23 [weekday] => Tuesday [month] => January [0] => 1138110765 )
Other Functions
Checkdate():Validates a gregorian date. Gettimeofday():Returns an array that contains current time information. Time():Return current time as a Unix Timestamp Mktime():Returns Unix timestamp for date.