DateTime.hx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package python.lib.datetime;
  2. extern class DateTime {
  3. public function new (year:Int, month:Int, day:Int, hour:Int=0, minute:Int=0, second:Int=0, microsecond:Int=0, tzinfo:TzInfo=null);
  4. public static var min : DateTime;
  5. public static var max : DateTime;
  6. public static var resolution : TimeDelta;
  7. public var year : Int;
  8. public var month : Int;
  9. public var day : Int;
  10. public var hour : Int;
  11. public var minute : Int;
  12. public var second : Int;
  13. public var microsecond : Int;
  14. public var tzinfo : TzInfo;
  15. public static function today ():DateTime;
  16. public static function now (?tzinfo:TzInfo):DateTime;
  17. public static function utcnow ():DateTime;
  18. public static function fromtimestamp (timestamp:Float, tzInfo:TzInfo=null):DateTime;
  19. public static function utcfromtimestamp (timestamp:Int):DateTime;
  20. public static function fromordinal (ordinal:Int):DateTime;
  21. public function strftime (format:String):String;
  22. public function replace (?year:Int = 1970, ?month:Int = 1, ?day:Int = 1, ?hour:Int = 0, ?minute:Int = 0, ?second:Int, ?microsecond:Int, ?tzinfo:TzInfo):DateTime;
  23. /* 0-6 */
  24. public function weekday():Int;
  25. /* 1-7 */
  26. public function isoweekday():Int;
  27. // python 3.3
  28. public function timestamp ():Float;
  29. static function __init__ ():Void
  30. {
  31. python.Syntax.importFromAs("datetime", "datetime", "python.lib.datetime.DateTime");
  32. }
  33. }