DayInMonth()
DayInMonth(integer $month, integer $year) : integer
Find the number of days in a month
Parameters
integer | $month | Month is between 1 and 12 inclusive |
integer | $year | is between 1 and 32767 inclusive |
Zap Calendar Date Helper Class
Helper class for various date functions
isFuture(integer $date, integer $tzid = "UTC") : boolean
Is given date in the future?
This routine differs from isAfterToday() in that isFuture() will return true for date-time values later in the same day.
integer | $date | date in Unix timestamp format |
integer | $tzid | PHP recognized timezone (default is UTC) |
isPast(integer $date, integer $tzid = "UTC") : boolean
Is given date in the past?
This routine differs from isBeforeToday() in that isPast() will return true for date-time values earlier in the same day.
integer | $date | date in Unix timestamp format |
integer | $tzid | PHP recognized timezone (default is UTC) |
addDate(integer $date, integer $hour, integer $min, integer $sec, integer $month, integer $day, integer $year, string $tzid = "UTC")
Date math: add or substract from current date to get a new date
integer | $date | date to add or subtract from |
integer | $hour | add or subtract hours from date |
integer | $min | add or subtract minutes from date |
integer | $sec | add or subtract seconds from date |
integer | $month | add or subtract months from date |
integer | $day | add or subtract days from date |
integer | $year | add or subtract years from date |
string | $tzid | PHP recognized timezone (default is UTC) |
getDateFromDay(integer $date, integer $week, integer $wday, string $tzid = "UTC") : integer
Date math: get date from week and day in specifiec month
This routine finds actual dates for the second Tuesday of the month, last Friday of the month, etc. For second Tuesday, use $week = 1, $wday = 2 for last Friday, use $week = -1, $wday = 5
integer | $date | Unix timestamp |
integer | $week | week number, 0 is first week, -1 is last |
integer | $wday | day of week, 0 is Sunday, 6 is Saturday |
string | $tzid | PHP supported timezone |
Unix timestamp
getAbsDate(string $date, string $rdate = "") : string
Convert from a relative date to an absolute date
Examples of relative dates are "-2y" for 2 years ago, "18m" for 18 months after today. Relative date uses "y", "m" and "d" for year, month and day. Relative date can be combined into comma separated list, i.e., "-1y,-1d" for 1 year and 1 day ago.
string | $date | relative date string (i.e. "1y" for 1 year from today) |
string | $rdate | reference date, or blank for current date (in SQL date-time format) |
in SQL date-time format