DateTime implementation based on amount of seconds since unix epoch. * By default all date/time data returned is in UTC.
Format this timestamp according to
%dTwo-digit day of the month (with leading zeros) 01 to 31
%eDay of the month, with a space preceding single digits. 1 to 31
%jDay of the year, 3 digits with leading zeros 001 to 366
%uISO-8601 numeric representation of the day of the week 1 (for Monday) though 7 (for Sunday)
%wNumeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday)
%mTwo digit representation of the month 01 (for January) through 12 (for December)
%CTwo digit representation of the century (year divided by 100, truncated to an integer) 19 for the 20th Century
%yTwo digit representation of the year Example: 09 for 2009, 79 for 1979
%YFour digit representation for the year Example: 2038
%VISO-8601:1988 week number of the given year, starting with the first week of the year with at least 4 weekdays,
- with Monday being the start of the week 01 through 53
%HTwo digit representation of the hour in 24-hour format 00 through 23
%kTwo digit representation of the hour in 24-hour format, with a space preceding single digits 0 through 23
%ITwo digit representation of the hour in 12-hour format 01 through 12
%l(lower-case 'L') Hour in 12-hour format, with a space preceding single digits 1 through 12
%MTwo digit representation of the minute 00 through 59
%pupper-case 'AM' or 'PM' based on the given time Example: AM for 00:31, PM for 22:23
%Plower-case 'am' or 'pm' based on the given time Example: am for 00:31, pm for 22:23
%rSame as "%I:%M:%S %p" Example: 09:34:17 PM for 21:34:17
%RSame as "%H:%M" Example: 00:35 for 12:35 AM, 16:44 for 4:44 PM
%STwo digit representation of the second 00 through 59
%TSame as "%H:%M:%S" Example: 21:34:17 for 09:34:17 PM
Time and Date Stamps
%DSame as "%m/%d/%y" Example: 02/05/09 for February 5, 2009
%FSame as "%Y-%m-%d" (commonly used in database datestamps) Example: 2009-02-05 for February 5, 2009
%sUnix Epoch Time timestamp Example: 305815200 for September 10, 1979 08:40:00 AM
%%A literal percentage character ("%")
Get current week number within a year according to the ISO 8601 date and time standard
Get day of the week.
Returns 0-6 (Sunday-Saturday) by default.
Returns 1-7 (Monday-Sunday) if
mondayBased = true
Get DateTime of a specified
weekDay in this month, which is the
numst in current month.
* * E.g. get DateTime of the second Sunday in current month. * If `num` is negative, then required `weekDay` will be searched from the end of this month. * If `num` == 0, returns a copy of this DateTime instance
Snap to nearest year, month, day, hour, minute, second or week. Returns new DateTime.
Assuming this instance is your local time, convert it ot UTC using current time offset of your timezone.
Does not use your timezone data, just current time offset.
If you dont care about your timezone and just need to convert your local time to utc,
use this method instead of
Returns new DateTime instance
Get amount of days in specified
month (1-12). If
month is 2 (February), you need to
specify whether you want to get amount of days in leap year or not.
Make DateTime instance using unix timestamp retreived from
Returns UTC time.
Convert 'YYYY-MM-DD hh:mm:ss' or 'YYYY-MM-DD' or 'YYYY-MM-DDThh:mm:ss[.SSS]Z' to DateTime
Assumes provided string represents UTC time.
Returns UTC time.
Make DateTime from unix timestamp (amount of seconds)
Returns UTC time.
Build DateTime using specified components
Builds UTC time.