FUEL CMS User Guide : Version 1.5.2


My Date Helper

Function Reference [+]

date_formatter('$date', ['$format'=FALSE])

Returns the date into a specified format. Will look at the configuration.

Returns

string

Parameters

(string) $date 
(mixed) $format 

datetime_now(['$hms'=TRUE])

Returns the current datetime value in MySQL format.

Returns

string

Parameters

(boolean) $hms 

is_date_format('$date')

Test for common date format.

Returns

boolean

Parameters

(string) $date 

is_date_db_format('$date')

Test for MySQL date format.

Returns

boolean

Parameters

(string) $date 

is_date_english_format('$date')

Test for mm/dd/yyyy format.

Returns

boolean

Parameters

(string) $date 

english_date('$date', ['$long'=FALSE], ['$timezone'=NULL], ['$delimiter'='/'])

Returns date in mm/dd/yyy format by default. Can be configured with a date_format config value.

Returns

string

Parameters

(string) $date 
(boolean) $long 
(string) $timezone 
(string) $delimiter 

english_date_verbose('$date')

Returns date in 'verbose' (e.g. Jan. 1, 2010) format. Can be configured with a date_format_verbose config value.

Returns

boolean

Parameters

(string) $date 

time_verbose('$time', ['$include_seconds'=FALSE])

Returns the time into a verbose format (e.g. 12hrs 10mins 10secs). must be passed a string in hh:mm format.

Returns

boolean

Parameters

(string) $time 
(boolean) $include_seconds 

english_date_to_db_format('$date', ['$hour'=0], ['$min'=0], ['$sec'=0], ['$ampm'='am'])

Converts a date from english (e.g. mm/dd/yyyy) to db format (e.g yyyy-mm-dd).

Returns

string

Parameters

(string) $date 
(int) $hour 
(int) $min 
(int) $sec 
(string) $ampm 

format_db_date(['$y'=NULL], ['$m'=NULL], ['$d'=NULL], ['$h'=NULL], ['$i'=NULL], ['$s'=NULL])

Formats a date into yyyy-mm-dd hh:mm:ss format.

Returns

string

Parameters

(int) $y 
(int) $m 
(int) $d 
(int) $h 
(int) $i 
(int) $s 

date_range_string('$date1', '$date2', [$params=array()])

Creates a date range string (e.g. January 1-10, 2010).

Returns

string

Parameters

(string) $date1 start date
(string) $date2 end date
(array) $params formatting parameters

pretty_date('$timestamp', ['$use_gmt'=FALSE])

Creates a string based on how long from the current time the date provided. (e.g. 10 minutes ago).

Returns

string

Parameters

(string) $timestamp 
(booelan) $use_gmt 

get_age('$bday_ts', ['$at_time_ts'=NULL])

Calculate the age between 2 dates.

Returns

string

Parameters

(int) $bday_ts 
(int) $at_time_ts 

standard_date(['$fmt'='DATE_RFC822'], ['$time'=''])

Standard Date.. OVERWRITE CI version due to bugs. Returns a date formatted according to the submitted standard. http://codeigniter.com/forums/viewthread/171906/.

Returns

string

Parameters

(string) $fmt the chosen format
(int) $time Unix timestamp

timestamp(['$date'=NULL])

Returns a timestamp from the provided time.

Returns

string

Parameters

(string) $date date (optional)

month(['$date'=NULL], ['$format'='M'])

Returns a the month value of a provided date.

Returns

string

Parameters

(string) $date date (optional)
(string) $format options are 'm/numeric', 'F/long', 'M/short' <- default  (optional)

day(['$date'=NULL], ['$format'='j'])

Returns a the day value of a provided date.

Returns

string

Parameters

(string) $date date (optional)
(string) $format options are 'd/leading', 'j' <- default  (optional)

weekday(['$date'=NULL], ['$format'='D'])

Returns a the weekday value of a provided date.

Returns

string

Parameters

(string) $date date (optional)
(string) $format options are 'l/full', 'N/numeric', 'D' <- default (optional)

year(['$date'=NULL], ['$format'='Y'])

Returns a the year value of a provided date.

Returns

string

Parameters

(string) $date date (optional)
(string) $format options are 'y/short', 'Y/long' <- default (optional)

hour(['$date'=NULL], ['$format'='12'])

Returns a the weekday value of a provided date.

Returns

string

Parameters

(string) $date date (optional)
(string) $format options are '24/military', '12' <- default (optional)

minute(['$date'=NULL], ['$format'='leading'])

Returns a the weekday value of a provided date.

Returns

string

Parameters

(string) $date date (optional)
(string) $format options are 'noleading', 'leading' <- default (optional)

second(['$date'=NULL], ['$format'='leading'])

Returns a the weekday value of a provided date.

Returns

string

Parameters

(string) $date date (optional)
(string) $format options are 'noleading', 'leading' <- default (optional)

ampm(['$date'=NULL], ['$format'='a'])

Returns a the ampm value of a provided date.

Returns

string

Parameters

(string) $date date (optional)
(string) $format options are 'A/upper/uppercase', 'a/lower/lowercase' <- default (optional)

is_midnight('$date')

Determines whether the time is midnight or not. Helps with dates that are set without time values.

Returns

string

Parameters

(string) $date date