Checking Pos_Date's constructor method.
It is set to automatically display the timezone of the server if none is specified.

Local Time: May 17th, 2012 03:32 PM
Tokyo Time: May 18th, 2012 05:32 AM


Checking Pos_Date's setTime() and setDate() functions. They have been programmed to not accept out-of-range times or invalid dates, unlike the standard methods, which will automatically adjust the input to something logical (like Feb. 31, 2007, to Mar. 1)

Time now: May 17th, 2012 03:32 PM
Date and time reset: August 8th, 2008 12:30 PM


Checking Pos_Date's getter methods.
All the dates are July 4, 2008.

Month, Day, Year; no leading zeroes: 7/4/2008
Month, Day, Year; leading zeroes: 07/04/2008
Day, Month, Year; no leading zeroes: 4/7/2008
Day, Month, Year; leading zeroes: 04/07/2008
Year, Month, Day; MySQL format: 2008-07-04


Displaying some getter methods.

getFullYear(): 2012
getYear(): 12
getMonth(): 5
getMonth(1): 05
getMonthName(): May
getMonthAbbr(): May
getDay(): 17
getDay(1): 17
getDayOrdinal(): 17th
getDayName(): Thursday
getDayAbbr(): Thu


Checking the add/subtract days/weeks/months/years methods.
All the dates start at July 4 2008.

Set Date: 7/4/2008
Date + 5 Days: 7/9/2008
Date - 5 Days: 6/29/2008
Date + 3 Weeks: 7/25/2008
Date - 3 Weeks: 6/13/2008
Date + 20 Months: 3/4/2010
Date - 18 Months: 1/4/2007
Date + 7 Years: 7/4/2015
Date - 5 Years: 7/4/2003

Checking the difference between using the custom addMonths() method versus DateTime's modify().

Starting Date: August 31st, 2008
Add 1 month using Pos_Date::addMonths(): September 30th, 2008
Add 1 month using DateTime::modify(): October 1st, 2008

Checking the difference between the custom subMonths() method versus DateTime's modify().

Starting Date: August 31st, 2008
Subtract 18 months using Pos_Date::subMonths(): February 28th, 2007
Subtract 18 months using DateTime::modify(): March 3rd, 2007

Checking the addYears() and subYears() functions, adding and subtracting 3 years from the current date.

Starting Date: May 17th, 2012
Add 3 years using Pos_Date::addYears(): May 17th, 2015
Add 3 years using DateTime::modify(): May 17th, 2015

Subracting 3 years using Pos_Date::addYears(): May 17th, 2009
Subracting 3 years using DateTime::modify(): May 17th, 2009


Checking the method to disply the number of days between two dates.
The example displays the difference from now and January 1 of next year.

229 days left 'til 2013.


Displaying the overridden _toString method.

Thursday, May 17th, 2012