class Date

The Date class provides a basic structure for date and time related information. Date instances can be created by

There is some extra functions available in the DateTools class.

In the context of haxe dates, a timestamp is defined as the number of milliseconds elapsed since 1st January 1970.

Class Fields

static function fromTime(t:Float): Date

Returns a Date from timestamp t.

static function now(): Date

Returns a Date representing the current local time.

Instance Fields

function new(year:Int, month:Int, day:Int, hour:Int, min:Int, sec:Int): Void

Creates a new date object from the given arguments.

The behaviour of a Date instance is only consistent across platforms if the the arguments describe a valid date.

  • month: 0 to 11
  • day: 1 to 31
  • hour: 0 to 23
  • min: 0 to 59
  • sec: 0 to 59

function getTime(): Float

Returns the timestamp of the date. It might only have a per-second precision depending on the platforms.