Date

The Date helper file contains functions that help you work with dates.

now

Returns the current time as a unix time stamp in GMT.

date_helper::now();

formatDate

Format unix timestamp to human format.

date_helper::formatDate(1412086445); // 09-30-2014 10:14 AM
date_helper::formatDate(1412086445, 'date-stamp'); // 09-30-2014
date_helper::formatDate(1412086445, 'time-stamp'); // 10:14 AM
date_helper::formatDate(1412086445, 'date'); // September 30, 2014
date_helper::formatDate(1412086445, 'date-time'); // September 30, 2014 at 10:14 AM
date_helper::formatDate(1412086445, 'date-short'); // Sep 30, 2014
date_helper::formatDate(1412086445, 'date-time-short'); // Sep 30, 2014 at 10:14 AM

humanSpan

Show the time difference between now and specified unix time stamp.

date_helper::humanSpan(1412086445); // Less than an hour ago

timezones

Return array with time zones.

date_helper::timezones();

month

Return month.

date_helper::month(2); // February

monthShort

Return month abbreviation.

date_helper::monthShort(2); // Feb

months

Return array with months.

date_helper::months();
date_helper::months(true); // add (0 => "select") item in the beginning of the array
date_helper::months(false, true); // prefix month numbers with zeros

days

Return array with days.

date_helper::days();
date_helper::days(true); // add (0 => "select") item in the beginning of the array
date_helper::days(false, true); // prefix day numbers with zeros

years

Return array with years.

date_helper::years();
date_helper::years(2014, 2000); // get years from 2000 to 2014
date_helper::years(2014, 2000); // add (0 => "select") item in the beginning of the array

hours

Return array with hours.

date_helper::hours();
date_helper::hours(true); // add (0 => "select") item in the beginning of the array
date_helper::hours(false, true); // prefix hour numbers with zeros

minutes

Return array with minutes.

date_helper::minutes();
date_helper::minutes(true); // add (0 => "select") item in the beginning of the array
date_helper::minutes(false, true); // prefix minute numbers with zeros
date_helper::minutes(false, false, 5); // minute increments of 5

hoursmapm

Return array with AM and PM items.

date_helper::hoursampm();