教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 综合文档 >

POCO C++库学习和分析-- 日期与时间(2)

来源:网络收集 时间:2026-08-09
导读: 18. DECEMBER 19. }; 20. 21. enum DaysOfWeek 22. /// Symbolic names for week day numbers (0 to 6). 23. { 24. SUNDAY = 0, 25. MONDAY, 26. TUESDAY, 27. WEDNESDAY, 28. THURSDAY, 29. FRIDAY, 30. SATURDAY

18. DECEMBER 19. }; 20.

21. enum DaysOfWeek

22. /// Symbolic names for week day numbers (0 to 6). 23. {

24. SUNDAY = 0, 25. MONDAY, 26. TUESDAY, 27. WEDNESDAY, 28. THURSDAY, 29. FRIDAY, 30. SATURDAY 31. }; 32. 33. DateTime();

34. /// Creates a DateTime for the current date and time. 35. 36.

37. DateTime(const Timestamp& timestamp);

38. /// Creates a DateTime for the date and time given in 39. /// a Timestamp. 40.

41. DateTime(int year, int month, int day, int hour = 0, int minute = 0, int 42. 43.

44. second = 0, int millisecond = 0, int microsecond = 0);

45. /// Creates a DateTime for the given Gregorian date and time. 46. /// * year is from 0 to 9999. 47. /// * month is from 1 to 12. 48. /// * day is from 1 to 31. 49. /// * hour is from 0 to 23. 50. /// * minute is from 0 to 59. 51. /// * second is from 0 to 59. 52. /// * millisecond is from 0 to 999. 53. /// * microsecond is from 0 to 999. 54. 55.

56. DateTime(double julianDay);

57. /// Creates a DateTime for the given Julian day. 58. 59.

60. DateTime(Timestamp::UtcTimeVal utcTime, Timestamp::TimeDiff diff); 61. /// Creates a DateTime from an UtcTimeVal and a TimeDiff. 62. ///

63. /// Mainly used internally by DateTime and friends. 64. 65.

66. DateTime(const DateTime& dateTime);

67. /// Copy constructor. Creates the DateTime from another one. 68. 69.

70. ~DateTime();

71. /// Destroys the DateTime. 72. 73.

74. DateTime& operator = (const DateTime& dateTime); 75. /// Assigns another DateTime. 76.

77. DateTime& operator = (const Timestamp& timestamp); 78. /// Assigns a Timestamp. 79. 80.

81. DateTime& operator = (double julianDay); 82. /// Assigns a Julian day. 83. 84.

85. DateTime& assign(int year, int month, int day, int hour = 0, int minute = 0, 86. 87.

88. int second = 0, int millisecond = 0, int microseconds = 0); 89. /// Assigns a Gregorian date and time. 90. /// * year is from 0 to 9999. 91. /// * month is from 1 to 12. 92. /// * day is from 1 to 31. 93. /// * hour is from 0 to 23. 94. /// * minute is from 0 to 59. 95. /// * second is from 0 to 59. 96. /// * millisecond is from 0 to 999. 97. /// * microsecond is from 0 to 999. 98. 99.

100. void swap(DateTime& dateTime);

101. /// Swaps the DateTime with another one. 102. 103.

104. int year() const;

105. /// Returns the year. 106.

107. int month() const;

108. /// Returns the month (1 to 12). 109.

110. int week(int firstDayOfWeek = MONDAY) const; 111. /// Returns the week number within the year.

112. /// FirstDayOfWeek should be either SUNDAY (0) or MONDAY (1). 113. /// The returned week number will be from 0 to 53. Week number 1 is 114. 115.

116. the week

117. /// containing January 4. This is in accordance to ISO 8601. 118. ///

119. /// The following example assumes that firstDayOfWeek is MONDAY. For 2005, which started

120. /// on a Saturday, week 1 will be the week starting on Monday, January 3.

121. /// January 1 and 2 will fall within week 0 (or the last week of the previous year). 122. ///

123. /// For 2007, which starts on a Monday, week 1 will be the week 124. 125.

126. startung on Monday, January 1.

127. /// There will be no week 0 in 2007. 128.

129. int day() const;

130. /// Returns the day witin the month (1 to 31). 131.

132. int dayOfWeek() const;

133. /// Returns the weekday (0 to 6, where

134. /// 0 = Sunday, 1 = Monday, ..., 6 = Saturday). 135.

136. int dayOfYear() const;

137. /// Returns the number of the day in the year. 138. /// January 1 is 1, February 1 is 32, etc. 139.

140. int hour() const;

141. /// Returns the hour (0 to 23). 142.

143. int hourAMPM() const;

144. /// Returns the hour (0 to 12). 145.

146. bool isAM() const;

147. /// Returns true if hour < 12; 148. 149.

150. bool isPM() const;

151. /// Returns true if hour >= 12. 152.

153. int minute() const;

154. /// Returns the minute (0 to 59). 155.

156. int second() const;

157. /// Returns the second (0 to 59). 158.

159. int millisecond() const;

160. /// Returns the millisecond (0 to 999) 161.

162. int microsecond() const;

163. /// Returns the microsecond (0 to 999)

164.

165. double julianDay() const;

166. /// Returns the julian day for the date and time. 167.

168. Timestamp timestamp() const;

169. /// Returns the date and time expressed as a Timestamp. 170. 171.

172. Timestamp::UtcTimeVal utcTime() const;

173. /// Returns the dat …… 此处隐藏:4223字,全部文档内容请下载后查看。喜欢就下载吧 ……

POCO C++库学习和分析-- 日期与时间(2).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/403843.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)