time();
<?php $nextWeek = time() + (7 * 24 * 60 * 60); // 7 days; 24 hours; 60 mins; 60secs print 'Now:'. date('Y-m-d') ."\n"; print 'Next Week: '. date('Y-m-d', $nextWeek) ."\n"; // or using strtotime(): print 'Next Week: '. date('Y-m-d', strtotime('+1 week')) ."\n"; ?>
date("M-d-Y", mktime(0, 0, 0, 12, 3, 2008))
mktime() function returns a unique timestamp of the specified parameter given in the argument list.
<?php $nextWeek = time() + (7 * 24 * 60 * 60); // 7 days; 24 hours; 60 mins; 60secs print 'Now:'. date('Y-m-d') ."\n"; print 'Next Week: '. date('Y-m-d', $nextWeek) ."\n"; // or using strtotime(): print 'Next Week: '. date('Y-m-d', strtotime('+1 week')) ."\n"; ?>
strftime('%A');
Prints the unique timestamp according to the parameter.
<?php print strftime("%A"); ?>
Some specific characters are used in the parameter of the strftime()function |
---|
%a - abbreviated weekday name according to the current locale |
%A - full weekday name according to the current locale |
%b - abbreviated month name according to the current locale |
%B - full month name according to the current locale |
%c - preferred date and time representation for the current locale |
%d - day of the month as a decimal number (range 01 to 31) |
%H - hour as a decimal number using a 24-hour clock (range 00 to 23) |
%I - hour as a decimal number using a 12-hour clock (range 01 to 12) |
%m - month as a decimal number (range 01 to 12) |
%M - minute as a decimal number |
%n - newline character |
%p - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale |
%t - tab character |
strtotime( 10 December 2008 );
Parse about any English textual datetime description into a Unix.
<?php print strtotime("now")."
"; print strtotime("10 September 2008")."
"; print strtotime("+1 day")."
"; print strtotime("+1 week")."
"; print strtotime("+1 week 2 days 4 hours 2 seconds")."
"; print strtotime("next Thursday")."
"; print strtotime("last Monday")."
"; ?>
After editing Click here: |
Output:
|
Hello World
|