Datetime.hx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (C)2005-2012 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. @:pythonImport("datetime", "datetime")
  24. extern class Datetime {
  25. public function new (year:Int, month:Int, day:Int, hour:Int=0, minute:Int=0, second:Int=0, microsecond:Int=0, tzinfo:Tzinfo=null);
  26. public static var min : Datetime;
  27. public static var max : Datetime;
  28. public static var resolution : Timedelta;
  29. public var year : Int;
  30. public var month : Int;
  31. public var day : Int;
  32. public var hour : Int;
  33. public var minute : Int;
  34. public var second : Int;
  35. public var microsecond : Int;
  36. public var tzinfo : Tzinfo;
  37. public static function today ():Datetime;
  38. public static function now (?tzinfo:Tzinfo):Datetime;
  39. public static function utcnow ():Datetime;
  40. public static function fromtimestamp (timestamp:Float, tzInfo:Tzinfo=null):Datetime;
  41. public static function utcfromtimestamp (timestamp:Int):Datetime;
  42. public static function fromordinal (ordinal:Int):Datetime;
  43. public function strftime (format:String):String;
  44. 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;
  45. /* 0-6 */
  46. public function weekday():Int;
  47. /* 1-7 */
  48. public function isoweekday():Int;
  49. // python 3.3
  50. public function timestamp ():Float;
  51. }