2
0

Date.hx 4.0 KB

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