Public Method Details |
dateNow |
public string dateNow( [ string $format ] )
|
|
Returns the current local date. NOTE: This function
retrieves the local date using strftime(), which mayor may not be 32-bit safe on your system.
|
Parameter |
|
string |
$format |
= >>"%Y%m%d"<< |
|
strftime() format to return the date |
|
Returns |
string the current date in specified format |
|
isValidDate |
public boolean isValidDate( string $day, string $month, string $year )
|
|
Returns true for valid date, false for invalid date.
|
Parameter |
|
string |
$day |
|
|
in format CCYY |
|
|
string |
$month |
|
|
in format MM |
|
|
string |
$year |
|
|
in format DD |
|
Returns |
boolean true /false |
|
isFutureDate |
public boolean isFutureDate( string $day, string $month, string $year )
|
|
Determines if given date is a future date from now.
|
Parameter |
|
string |
$day |
|
|
in format CCYY |
|
|
string |
$month |
|
|
in format MM |
|
|
string |
$year |
|
|
in format DD |
|
Returns |
boolean true /false |
|
isPastDate |
public boolean isPastDate( string $day, string $month, string $year )
|
|
Determines if given date is a past date from now.
|
Parameter |
|
string |
$day |
|
|
in format CCYY |
|
|
string |
$month |
|
|
in format MM |
|
|
string |
$year |
|
|
in format DD |
|
Returns |
boolean true /false |
|
dayOfWeek |
public int dayOfWeek( [ string $day, string $month, string $year ] )
|
|
Returns day of week for given date, 0=Sunday
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default is current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default is current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default is current local day |
|
Returns |
int $weekday_number |
|
weekOfYear |
public integer weekOfYear( string $day, string $month, string $year )
|
|
Returns week of the year, first Sunday is first day of first week
|
Parameter |
|
string |
$day |
|
|
in format CCYY |
|
|
string |
$month |
|
|
in format MM |
|
|
string |
$year |
|
|
in format DD |
|
Returns |
integer $week_number |
|
julianDate |
public int julianDate( [ string $day, string $month, string $year ] )
|
|
Returns number of days since 31 December of year before given date.
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default is current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default is current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default is current local day |
|
Returns |
int $julian |
|
quarterOfYear |
public int quarterOfYear( [ string $day, string $month, string $year ] )
|
|
Returns quarter of the year for given date
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
Returns |
int $year_quarter |
|
beginOfNextMonth |
public string beginOfNextMonth( [ string $day, string $month, string $year, string $format ] )
|
|
Returns date of begin of next month of given date.
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
endOfNextMonth |
public string endOfNextMonth( [ string $day, string $month, string $year, string $format ] )
|
|
Returns date of the last day of next month of given date.
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
beginOfPrevMonth |
public string beginOfPrevMonth( [ string $day, string $month, string $year, string $format ] )
|
|
Returns date of the first day of previous month of given date.
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
endOfPrevMonth |
public string endOfPrevMonth( [ string $day, string $month, string $year, string $format ] )
|
|
Returns date of the last day of previous month for given date.
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
nextWeekday |
public string nextWeekday( [ string $day, string $month, string $year, string $format ] )
|
|
Returns date of the next weekday of given date,
skipping from Friday to Monday.
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
prevWeekday |
public string prevWeekday( [ string $day, string $month, string $year, string $format ] )
|
|
Returns date of the previous weekday,
skipping from Monday to Friday.
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
nextDayOfWeek |
public string nextDayOfWeek( int $dow, [ string $day, string $month, string $year, string $format, boolean $onOrAfter ] )
|
|
Returns date of the next specific day of the week
from the given date.
|
Parameter |
|
int |
$dow |
|
|
of week, 0=Sunday |
|
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
if true and days are same, returns current day |
|
|
boolean |
$onOrAfter |
= >>false<< |
|
for returned date |
|
Returns |
string date in given format |
|
prevDayOfWeek |
public string prevDayOfWeek( int $dow, [ string $day, string $month, string $year, string $format, boolean $onOrBefore ] )
|
|
Returns date of the previous specific day of the week
from the given date.
|
Parameter |
|
int |
$dow |
|
|
of week, 0=Sunday |
|
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
if true and days are same, returns current day |
|
|
boolean |
$onOrBefore |
= >>false<< |
|
for returned date |
|
Returns |
string date in given format |
|
nextDayOfWeekOnOrAfter |
public string nextDayOfWeekOnOrAfter( int $dow, [ string $day, string $month, string $year, string $format ] )
|
|
Returns date of the next specific day of the week
on or before the given date.
|
Parameter |
|
int |
$dow |
|
|
of week, 0=Sunday |
|
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
prevDayOfWeekOnOrBefore |
public string prevDayOfWeekOnOrBefore( int $dow, [ string $day, string $month, string $year, string $format ] )
|
|
Returns date of the previous specific day of the week
on or before the given date.
|
Parameter |
|
int |
$dow |
|
|
of week, 0=Sunday |
|
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
nextDay |
public string nextDay( [ string $day, string $month, string $year, string $format ] )
|
|
Returns date of day after given date.
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
prevDay |
public string prevDay( [ string $day, string $month, string $year, string $format ] )
|
|
Returns date of day before given date.
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
defaultCentury |
public string defaultCentury( string $year )
|
|
Sets century for 2 digit year.
51-99 is 19, else 20
|
Parameter |
|
string |
$year |
|
|
2 digit year |
|
Returns |
string 4 digit year |
|
dateDiff |
public int dateDiff( string $day1, string $month1, string $year1, string $day2, string $month2, string $year2 )
|
|
Returns number of days between two given dates.
|
Parameter |
|
string |
$day1 |
|
|
in format CCYY |
|
|
string |
$month1 |
|
|
in format MM |
|
|
string |
$year1 |
|
|
in format DD |
|
|
string |
$day2 |
|
|
in format CCYY |
|
|
string |
$month2 |
|
|
in format MM |
|
|
string |
$year2 |
|
|
in format DD |
|
Returns |
int absolute number of days between dates,
-1 if there is an error. |
|
daysInMonth |
public int daysInMonth( [ string $month ], string $year )
|
|
Find the number of days in the given month.
|
Parameter |
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
|
|
Warning: documentation is missing. |
|
Returns |
int number of days |
|
weeksInMonth |
public int weeksInMonth( [ string $month, string $year ] )
|
|
Returns the number of rows on a calendar month. Useful for
determining the number of rows when displaying a typicalmonth calendar.
|
Parameter |
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format YYCC, default current local year |
|
Returns |
int number of weeks |
|
firstOfMonthWeekday |
public int firstOfMonthWeekday( [ string $month, string $year ] )
|
|
Find the day of the week for the first of the month of given date.
|
Parameter |
|
string |
$month |
= >>""<< |
|
in format CCYY, default to current local year |
|
|
string |
$year |
= >>""<< |
|
in format MM, default to current local month |
|
Returns |
int number of weekday for the first day, 0=Sunday |
|
beginOfMonth |
public string beginOfMonth( [ string $month, string $year, string $format ] )
|
|
Return date of first day of month of given date.
|
Parameter |
|
string |
$month |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$year |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
beginOfWeek |
public string beginOfWeek( [ string $day, string $month, string $year, string $format ] )
|
|
Find the month day of the beginning of week for given date,
using DATE_CALC_BEGIN_WEEKDAY. (can return weekday of prev month.)
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
endOfWeek |
public string endOfWeek( [ string $day, string $month, string $year, string $format ] )
|
|
Find the month day of the end of week for given date,
using DATE_CALC_BEGIN_WEEKDAY. (can return weekdayof following month.)
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
beginOfNextWeek |
public string beginOfNextWeek( [ string $day, string $month, string $year, string $format ] )
|
|
Find the month day of the beginning of week after given date,
using DATE_CALC_BEGIN_WEEKDAY. (can return weekday of prev month.)
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
beginOfPrevWeek |
public string beginOfPrevWeek( [ string $day, string $month, string $year, string $format ] )
|
|
Find the month day of the beginning of week before given date,
using DATE_CALC_BEGIN_WEEKDAY. (can return weekday of prev month.)
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
getCalendarWeek |
public array getCalendarWeek( [ string $day, string $month, string $year, string $format ] )
|
|
Return an array with days in week
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
array $week [$weekday] |
|
getCalendarMonth |
public array getCalendarMonth( [ string $month, string $year, string $format ] )
|
|
Return a set of arrays to construct a calendar month for
the given date.
|
Parameter |
|
string |
$month |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$year |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
array $month [$row][$col] |
|
getCalendarYear |
public array getCalendarYear( [ string $year, string $format ] )
|
|
Return a set of arrays to construct a calendar year for
the given date.
|
Parameter |
|
string |
$year |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
array $year [$month][$row][$col] |
|
dateToDays |
public integer dateToDays( string $day, string $month, string $year )
|
|
Converts a date to number of days since a
distant unspecified epoch.
|
Parameter |
|
string |
$day |
|
|
in format CCYY |
|
|
string |
$month |
|
|
in format MM |
|
|
string |
$year |
|
|
in format DD |
|
Returns |
integer number of days |
|
daysToDate |
public string daysToDate( int $days, [ string $format ] )
|
|
Converts number of days to a distant unspecified epoch.
|
Parameter |
|
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in specified format |
|
NWeekdayOfMonth |
public string NWeekdayOfMonth( string $occurance, string $dayOfWeek, string $month, string $year, [ string $format ] )
|
|
Calculates the date of the Nth weekday of the month,
such as the second Saturday of January 2000.
|
Parameter |
|
string |
$occurance |
|
|
: 1=first, 2=second, 3=third, etc. |
|
|
string |
$dayOfWeek |
|
|
: 0=Sunday, 1=Monday, etc. |
|
|
string |
$month |
|
|
in format CCYY |
|
|
string |
$year |
|
|
in format MM |
|
|
string |
$format |
= >>"%Y%m%d"<< |
|
for returned date |
|
Returns |
string date in given format |
|
dateFormat |
public string dateFormat( string $day, string $month, string $year, string $format )
|
|
Formats the date in the given format, much like
strfmt(). This function is used to alleviate theproblem with 32-bit numbers for dates pre 1970or post 2038, as strfmt() has on most systems.Most of the formatting options are compatible.formatting options:%a abbreviated weekday name (Sun, Mon, Tue)%A full weekday name (Sunday, Monday, Tuesday)%b abbreviated month name (Jan, Feb, Mar)%B full month name (January, February, March)%d day of month (range 00 to 31)%e day of month, single digit (range 0 to 31)%E number of days since unspecified epoch (integer)(%E is useful for passing a date in a URL asan integer value. Then simply usedaysToDate() to convert back to a date.)%j day of year (range 001 to 366)%m month as decimal number (range 1 to 12)%n newline character (\n)%t tab character (\t)%w weekday as decimal (0 = Sunday)%U week number of current year, first sunday as first week%y year as decimal (range 00 to 99)%Y year as decimal including century (range 0000 to 9999)%% literal '%'
|
Parameter |
|
string |
$day |
|
|
in format CCYY |
|
|
string |
$month |
|
|
in format MM |
|
|
string |
$year |
|
|
in format DD |
|
|
string |
$format |
|
|
for returned date |
|
Returns |
string date in given format |
|
getYear |
public string getYear( )
|
|
Returns the current local year in format CCYY
|
Returns |
string year in format CCYY |
|
getMonth |
public string getMonth( )
|
|
Returns the current local month in format MM
|
Returns |
string month in format MM |
|
getDay |
public string getDay( )
|
|
Returns the current local day in format DD
|
Returns |
string day in format DD |
|
getMonthFullname |
public string getMonthFullname( string $month )
|
|
Returns the full month name for the given month
|
Parameter |
|
string |
$month |
|
|
in format MM |
|
Returns |
string full month name |
|
getMonthAbbrname |
public string getMonthAbbrname( string $month, [ integer $length ] )
|
|
Returns the abbreviated month name for the given month
|
Parameter |
|
string |
$month |
|
|
in format MM |
|
|
integer |
$length |
= >>3<< |
|
length of abbreviation, default is 3 |
|
Returns |
string abbreviated month name |
|
getWeekdayFullname |
public string getWeekdayFullname( [ string $day, string $month, string $year ] )
|
|
Returns the full weekday name for the given date
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
Returns |
string full month name |
|
getWeekdayAbbrname |
public string getWeekdayAbbrname( [ string $day, string $month, string $year, integer $length ] )
|
|
Returns the abbreviated weekday name for the given date
|
Parameter |
|
string |
$day |
= >>""<< |
|
in format CCYY, default current local year |
|
|
string |
$month |
= >>""<< |
|
in format MM, default current local month |
|
|
string |
$year |
= >>""<< |
|
in format DD, default current local day |
|
|
integer |
$length |
= >>3<< |
|
length of abbreviation, default is 3 |
|
Returns |
string full month name |
|