Skip to main content

DateFormat PHP Class

Published on
DateFormat is a PHP class for easily displaying timestamps in a PHP project, along with displaying a "time since" feature, much like the one used on Facebook and other sites. A  demo of the class is available in my script playground:  glamanate.com/playground/DateFormat/.

DateFormat Class Documentation

Initialize Class

$date = new FormatDate(time());

Numerical Day

$date->Day();

Text Day

$date->WeekDay();

Month (Full)

$date->Month();

Month (Short)

$date->MonthShort();

Month (Numerical)

$date->MonthNum();

Year (Full)

$date->YearFull();

Year (Short)

$date->Year();

Military (Seconds)

$date->MilitaryFull();

Military (No seconds)

$date->Military();

Standard (Full)

$date->StandardFull();

Standard

$date->Standard();

Text Date (Full)

$date->TextDate();

Text Date (Short)

$date->TextDateShort();

Numerical Date (Full)

$date->NumDate();

Numerical Date (Short)

$date->NumDateShort();

Month and Day (Full)

$date->MonthDay();

Month and Day (Short)

$date->MonthDayShort();

Time Since

$date->TimeSince($timestamp);
#