2
0

Datetime.hx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (C)2005-2017 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. package python.lib.datetime;
  23. import python.lib.time.StructTime;
  24. @:pythonImport("datetime", "datetime")
  25. extern class Datetime {
  26. public function new (year:Int, month:Int, day:Int, hour:Int=0, minute:Int=0, second:Int=0, microsecond:Int=0, tzinfo:Tzinfo=null);
  27. public static var min : Datetime;
  28. public static var max : Datetime;
  29. public static var resolution : Timedelta;
  30. public var year : Int;
  31. public var month : Int;
  32. public var day : Int;
  33. public var hour : Int;
  34. public var minute : Int;
  35. public var second : Int;
  36. public var microsecond : Int;
  37. public var tzinfo : Tzinfo;
  38. public static function today ():Datetime;
  39. public static function now (?tzinfo:Tzinfo):Datetime;
  40. public static function utcnow ():Datetime;
  41. public static function fromtimestamp (timestamp:Float, tzInfo:Tzinfo=null):Datetime;
  42. public static function utcfromtimestamp (timestamp:Int):Datetime;
  43. public static function fromordinal (ordinal:Int):Datetime;
  44. public function timetuple():StructTime;
  45. public function strftime (format:String):String;
  46. 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;
  47. /* 0-6 */
  48. public function weekday():Int;
  49. /* 1-7 */
  50. public function isoweekday():Int;
  51. // python 3.3
  52. public function timestamp ():Float;
  53. }