Date.hx 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package java.util;
  2. import haxe.Int64;
  3. /*
  4. * Copyright (c) 2005, The haXe Project Contributors
  5. * All rights reserved.
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions are met:
  8. *
  9. * - Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * - Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
  16. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
  19. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  20. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  21. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  22. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  23. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  24. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  25. * DAMAGE.
  26. */
  27. /**
  28. The Date class is used for date manipulation. There is some extra functions
  29. available in the [DateTools] class.
  30. **/
  31. extern class Date
  32. {
  33. /**
  34. Creates a new date object.
  35. **/
  36. @:overload(function() : Void { })
  37. @:overload(function(str : String) : Void { })
  38. @:overload(function(time : Int64) : Void { })
  39. function new(year : Int, month : Int, day : Int, hour : Int, min : Int, sec : Int ) : Void;
  40. /**
  41. Returns the timestamp of the date. It's the number of milliseconds
  42. elapsed since 1st January 1970. It might only have a per-second precision
  43. depending on the platforms.
  44. **/
  45. function getTime() : Int64;
  46. /**
  47. Returns the hours value of the date (0-23 range).
  48. **/
  49. function getHours() : Int;
  50. /**
  51. Returns the minutes value of the date (0-59 range).
  52. **/
  53. function getMinutes() : Int;
  54. /**
  55. Returns the seconds of the date (0-59 range).
  56. **/
  57. function getSeconds() : Int;
  58. /**
  59. Returns the full year of the date.
  60. **/
  61. function getYear() : Int;
  62. /**
  63. Returns the month of the date (0-11 range).
  64. **/
  65. function getMonth() : Int;
  66. /**
  67. Returns the day of the date (1-31 range).
  68. **/
  69. function getDate() : Int;
  70. /**
  71. Returns the week day of the date (0-6 range).
  72. **/
  73. function getDay() : Int;
  74. /**
  75. Returns a string representation for the Date, by using the
  76. standard format [YYYY-MM-DD HH:MM:SS]. See [DateTools.format] for
  77. other formating rules.
  78. **/
  79. function toString():String;
  80. }