View source

abstract thx.DateTimeUtc(Int64)

Available on all platforms

DateTimeUtc represents a UTC instant between -29228-09-14T02:48:05.4775807Z and 29228-09-14T02:48:05.4775807Z.

DateTimeUtc represents an moment in time with no time-zone offset and it is relative to UTC (Coordinated Universal Time).

Class Fields

inline function compare(a:DateTimeUtc, b:DateTimeUtc):Int

function create(year:Int, month:Int, day:Int, hour:Int = 0, minute:Int = 0, second:Int = 0, millisecond:Int = 0):DateTimeUtc

Creates a DateTime instance from its components (year, mont, day, hour, minute second and millisecond).

All time components are optionals.

function dateToTicks(year:Int, month:Int, day:Int):Int64

function daysInMonth(year:Int, month:Int):Int

function daysRange(start:DateTimeUtc, end:DateTimeUtc):Array<DateTimeUtc>

Creates an array of dates that begin at start and end at end included. Time values are pick from the start value except for the last value that will match end. No interpolation is made.

inline function equals(self:DateTimeUtc, that:DateTimeUtc):Bool

function fromDate(date:Date):DateTimeUtc

Transforms a Haxe native Date instance into DateTimeUtc.

function fromInt64(ticks:Int64):DateTimeUtc

Returns a date/time from an Int64 value. The value is the number of ticks (tenth of microseconds) since 1 C.E. (A.D.).

function fromString(s:String):DateTimeUtc

Parses a string into a DateTimeUtc value. If parsing is not possible an exception is thrown.

function fromTime(timestamp:Float):DateTimeUtc

Transforms an epoch time value in milliconds into DateTimeUtc.

inline function greater(self:DateTimeUtc, that:DateTimeUtc):Bool

inline function greaterEquals(self:DateTimeUtc, that:DateTimeUtc):Bool

function isLeapYear(year:Int):Bool

inline function less(self:DateTimeUtc, that:DateTimeUtc):Bool

inline function lessEquals(self:DateTimeUtc, that:DateTimeUtc):Bool

inline function notEquals(self:DateTimeUtc, that:DateTimeUtc):Bool

function now():DateTimeUtc

Returns the system date/time relative to UTC.

function rawDateToTicks(year:Int, month:Int, day:Int):Int64

Instance Fields

var day(get,null):Int

var dayOfWeek(get,null):Weekday

var dayOfYear(get,null):Int

var hour(get,null):Int

var isInLeapYear(get,null):Bool

var microsecond(get,null):Int

var millisecond(get,null):Int

var minute(get,null):Int

var month(get,null):Int

var monthDays(get,null):Int

var second(get,null):Int

var tickInSecond(get,null):Int

var ticks(get,null):Int64

var timeOfDay(get,null):Time

var year(get,null):Int

inline function new(ticks:Int64):DateTimeUtc

inline function addDays(days:Float):DateTimeUtc

inline function addHours(hours:Float):DateTimeUtc

inline function addMilliseconds(milliseconds:Int):DateTimeUtc

inline function addMinutes(minutes:Float):DateTimeUtc

function addMonths(months:Int):DateTimeUtc

inline function addSeconds(seconds:Float):DateTimeUtc

inline function addYears(years:Int):DateTimeUtc

inline function compareTo(other:DateTimeUtc):Int

function daysInThisMonth():Int

Tells how many days in the month of this date.

Returns:

Int, the number of days in the month.

inline function equalsTo(that:DateTimeUtc):Bool

inline function greaterEqualsTo(that:DateTimeUtc):Bool

inline function greaterThan(that:DateTimeUtc):Bool

function jump(period:TimePeriod, amount:Int):DateTimeUtc

Get a date relative to the current date, shifting by a set period of time. Please note this works by constructing a new date object, rather than using DateTools.delta(). The key difference is that this allows us to jump over a period that may not be a set number of seconds. For example, jumping between months (which have different numbers of days), leap years, leap seconds, daylight savings time changes etc. @param period The TimePeriod you wish to jump by, Second, Minute, Hour, Day, Week, Month or Year. @param amount The multiple of period that you wish to jump by. A positive amount moves forward in time, a negative amount moves backward.

inline function lessEqualsTo(that:DateTimeUtc):Bool

inline function lessThan(that:DateTimeUtc):Bool

function max(other:DateTimeUtc):DateTimeUtc

function min(other:DateTimeUtc):DateTimeUtc

function nearEqualsTo(other:DateTimeUtc, span:Time):Bool

inline function nextDay():DateTimeUtc

Returns a new date, exactly 1 day after the given date/time.

inline function nextHour():DateTimeUtc

Returns a new date, exactly 1 hour after the given date/time.

inline function nextMinute():DateTimeUtc

Returns a new date, exactly 1 minute after the given date/time.

inline function nextMonth():DateTimeUtc

Returns a new date, exactly 1 month after the given date/time.

inline function nextSecond():DateTimeUtc

Returns a new date, exactly 1 second after the given date/time.

inline function nextWeek():DateTimeUtc

Returns a new date, exactly 1 week after the given date/time.

inline function nextYear():DateTimeUtc

Returns a new date, exactly 1 year after the given date/time.

inline function notEqualsTo(that:DateTimeUtc):Bool

inline function prevDay():DateTimeUtc

Returns a new date, exactly 1 day before the given date/time.

inline function prevHour():DateTimeUtc

Returns a new date, exactly 1 hour before the given date/time.

inline function prevMinute():DateTimeUtc

Returns a new date, exactly 1 minute before the given date/time.

inline function prevMonth():DateTimeUtc

Returns a new date, exactly 1 month before the given date/time.

inline function prevSecond():DateTimeUtc

Returns a new date, exactly 1 second before the given date/time.

inline function prevWeek():DateTimeUtc

Returns a new date, exactly 1 week before the given date/time.

inline function prevYear():DateTimeUtc

Returns a new date, exactly 1 year before the given date/time.

function sameDay(other:DateTimeUtc):Bool

Returns true if this date and the other date share the same year, month and day.

function sameHour(other:DateTimeUtc):Bool

Returns true if this date and the other date share the same year, month, day and hour.

function sameMinute(other:DateTimeUtc):Bool

Returns true if this date and the other date share the same year, month, day, hour and minute.

function sameMonth(other:DateTimeUtc):Bool

Returns true if this date and the other date share the same year and month.

function sameSecond(other:DateTimeUtc):Bool

Returns true if this date and the other date share the same year, month, day, hour, minute and second.

function sameYear(other:DateTimeUtc):Bool

Returns true if this date and the other date share the same year.

function snapNext(period:TimePeriod):DateTimeUtc

Snaps a time to the next second, minute, hour, day, week, month or year.

Parameters:
period

Either: Second, Minute, Hour, Day, Week, Month or Year

function snapNextWeekDay(weekday:Weekday):DateTimeUtc

Snaps a date to the next given weekday. The time within the day will stay the same. If you are already on the given day, the date will not change.

Parameters:
date

The date value to snap

day

Day to snap to. Either Sunday, Monday, Tuesday etc.

Returns:

The date of the day you have snapped to.

function snapPrev(period:TimePeriod):DateTimeUtc

Snaps a time to the previous second, minute, hour, day, week, month or year.

Parameters:
period

Either: Second, Minute, Hour, Day, Week, Month or Year

function snapPrevWeekDay(weekday:Weekday):DateTimeUtc

Snaps a date to the previous given weekday. The time within the day will stay the same. If you are already on the given day, the date will not change.

Parameters:
date

The date value to snap

day

Day to snap to. Either Sunday, Monday, Tuesday etc.

Returns:

The date of the day you have snapped to.

function snapTo(period:TimePeriod):DateTimeUtc

Snaps a time to the nearest second, minute, hour, day, week, month or year.

Parameters:
period

Either: Second, Minute, Hour, Day, Week, Month or Year

function snapToWeekDay(weekday:Weekday, firstDayOfWk:Weekday = Sunday):DateTimeUtc

Snaps a date to the given weekday inside the current week. The time within the day will stay the same. If you are already on the given day, the date will not change.

Parameters:
date

The date value to snap

day

Day to snap to. Either Sunday, Monday, Tuesday etc.

firstDayOfWk

The first day of the week. Default to Sunday.

Returns:

The date of the day you have snapped to.

inline function toDate():Date

inline function toDateTime():DateTime

function toString():String

inline function toTime():Float

function withDay(day:Int):DateTimeUtc

function withHour(hour:Int):DateTimeUtc

function withMillisecond(millisecond:Int):DateTimeUtc

function withMinute(minute:Int):DateTimeUtc

function withMonth(month:Int):DateTimeUtc

function withSecond(second:Int):DateTimeUtc

function withYear(year:Int):DateTimeUtc