system/helpers/date.php

Class: date_Core

class date_Core

Date helper class.

date_Core :: unix2dos

public static function unix2dos

Converts a UNIX timestamp to DOS format.

Parameters:

integer timestamp
(FALSE) UNIX timestamp

Return: integer


date_Core :: dos2unix

public static function dos2unix

Converts a DOS timestamp to UNIX format.

Parameters:

integer timestamp
(FALSE) DOS timestamp

Return: integer


date_Core :: offset

public static function offset

Returns the offset (in seconds) between two time zones.

Parameters:

string remote
timezone that to find the offset of
string or boolean local
(TRUE) timezone used as the baseline

See: http://php.net/timezones

Return: integer


date_Core :: seconds

public static function seconds

Number of seconds in a minute, incrementing by a step.

Parameters:

integer step
(int 1) amount to increment each step by, 1 to 30
integer start
(int 0) start value
integer end
(int 60) end value

Return: array A mirrored (foo => foo) array from 1-60.


date_Core :: minutes

public static function minutes

Number of minutes in an hour, incrementing by a step.

Parameters:

integer step
(int 5) amount to increment each step by, 1 to 30

Return: array A mirrored (foo => foo) array from 1-60.


date_Core :: hours

public static function hours

Number of hours in a day.

Parameters:

integer step
(int 1) amount to increment each step by
boolean long
(FALSE) use 24-hour time
integer start
(NULL) the hour to start at

Return: array A mirrored (foo => foo) array from start-12 or start-23.


date_Core :: ampm

public static function ampm

Returns AM or PM, based on a given hour.

Parameters:

integer hour
number of the hour

Return: string


date_Core :: adjust

public static function adjust

Adjusts a non-24-hour number into a 24-hour number.

Parameters:

integer hour
hour to adjust
string ampm
AM or PM

Return: string


date_Core :: days

public static function days

Number of days in month.

Parameters:

integer month
number of month
integer year
(FALSE) number of year to check month, defaults to the current year

Return: array A mirrored (foo => foo) array of the days.


date_Core :: months

public static function months

Number of months in a year

Return: array A mirrored (foo => foo) array from 1-12.


date_Core :: years

public static function years

Returns an array of years between a starting and ending year. Uses the current year +/- 5 as the max/min.

Parameters:

integer start
(FALSE) starting year
integer end
(FALSE) ending year

Return: array


date_Core :: timespan

public static function timespan

Returns time difference between two timestamps, in human readable format.

Parameters:

integer time1
timestamp
integer time2
(FALSE) timestamp, defaults to the current time
string output
(string years,months,weeks,days,hours,minutes,seconds) formatting string

Return: string|array