Create a date object
This creates a date object using the specified timestamp and format.
ecdDate
ecdDate
([string $date = null], [string $type = 'unixtimestamp'])
-
string
$date: the date to parse
-
string
$type: one of 'datetime', 'timestamp' (or 'sqltimestamp') or 'unixtimestamp'
generate a in-memory calendar structure
- the structure is made up like this, taking October 2004 as an example:
Array(Array(null, null, null, null, null, 1, 2) Array(3, 4, 5, 6, 7, 8, 9), Array(10, 11, 12, 13, 14, 15, 16), Array(17, 18, 19, 20, 21, 22, 23), Array(24, 25, 26, 27, 28, 29, 30));
Array
calendar
([mixed $date = null], mixed $firstday)
the default callback for the calendar_str
-
string
calendar_def_callback
(string $action, Date $date, string $data)
-
string
$action: one of
- 'next_month', 'next_year', 'prev_month', 'prev_year': the date controls
- 'day_of_week': each header
- 'day': each day
-
Date
$date: the "current" date the calendar is generated for
-
string
$data: the "default" data displayed. one of:
- 'next_month': ">"
- 'next_year': ">>"
- 'prev_month': "<"
- 'prev_year': "<<"
- 'day_of_week': 'di', 'lu', 'ma', 'me', ...
- 'day': the day number
print a calendar in an HTML table
- this uses the calendar() function to generate a calendar based on the given date. the calendar is created in-memor and returned as a string.
generated styles:
- table.calendar: the main calendar table
- table.calendar tr.header: the controls and current month/year row
- table.calendar tr.day_of_week: the list of days row
- table.calendar tr td.today: today
- table.calendar tr td.highlight: the date given to calendar_str
string
calendar_str
([Date $date = null], int $firstday, [function $callback = null])
-
Date
$date: a day for which you want a calendar around
-
int
$firstday: the first day of the week (0 = sunday, default).
-
function
$callback: a callback that is called to handle the printing of some parts of the calendar. Defaults to array('ecdDate', 'calendar_def_callback').
check validity of a "time" string
if
checktime
(mixed $time)
a SQL DATETIME
string
datetime
([string $sep = '-'])
-
string
$sep: the separator
generate bounds enclosing the day the $timestamp is in
Array
dayBounds
([int $timestamp = null])
-
int
$timestamp: a UNIX timestamp of the time we want to check
void
getLongDate
(mixed $lang)
void
getShortDate
(mixed $lang)
Compute how much time this number of seconds represents
This splits the seconds into years, weeks, days, hours, minutes and seconds.
For the purposes of this function, a year is 365 days, which are 24 hours, which are 3600 seconds. This is of course imprecise as the Earth isn't so flat with the seconds humans chose.
array
how_much_time
(int $timestamp, [mixed $max = YEARS], [mixed $round = SECONDS])
-
int
$timestamp: a number of seconds passed
How much time has passed in readable text.
The time (in years, weeks, days, hours, minutes and seconds) is computed using how_much_time() and returned as a string.
Example:
- print how_much_time_str(862150606);
will print the string:
- 27 années, 17 semaines, 4 jours, 14 heures, 16 minutes et 46 secondes
void
how_much_time_str
(mixed $timestamp, [mixed $max = YEARS], [mixed $round = SECONDS])
void
round_seconds
(mixed $timestamp, mixed $round)
the short time (hours and minutes)
void
shortTime
()
the "time" part of this date
void
time
()
the UNIX timestamp of this date (seconds since epoch)
void
unixtimestamp
()
check the validity of the given date
void
valid
()
generate bounds enclosing the week the $timestamp is in
Array
weekBounds
([int $timestamp = null], int $start_day)
-
int
$timestamp: a UNIX timestamp of the time we want to check
-
int
$start_day: the first day of the week (0,7 = sunday, 1 = monday, etc)