Working with Dates and Times in PHP - Another method
(Page 5 of 6 )
This is another method to access the current date or the given timestamp that you've produced by your own script. The method, or you can call it function, is getdate(). This function will produce an associative array containing the date information. The array key is:
"seconds" - seconds
"minutes" - minutes
"hours" - hours
"mday" - day of the month
"wday" - day of the week, numeric: from 0 as Sunday up to 6 as Saturday
"mon" - month, numeric
"year" - year, numeric
"yday" - day of the year, numeric; i.e. "299"
"weekday" - day of the week, textual, full; i.e. "Friday"
"month" - month, textual, full; i.e. "January"
Example :
$today = getdate();
print $today["month"] // it will print the month of current date
print $today["weekday"] // it will print the day of current date
Next: My own Language >>
More PHP Articles
More By Hermawan Haryanto