QwtDate.3 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. .TH "QwtDate" 3 "Mon Dec 28 2020" "Version 6.1.6" "Qwt User's Guide" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. QwtDate \- A collection of methods around date/time values\&.
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .PP
  10. \fC#include <qwt_date\&.h>\fP
  11. .SS "Public Types"
  12. .in +1c
  13. .ti -1c
  14. .RI "enum \fBWeek0Type\fP { \fBFirstThursday\fP, \fBFirstDay\fP }"
  15. .br
  16. .ti -1c
  17. .RI "enum \fBIntervalType\fP { \fBMillisecond\fP, \fBSecond\fP, \fBMinute\fP, \fBHour\fP, \fBDay\fP, \fBWeek\fP, \fBMonth\fP, \fBYear\fP }"
  18. .br
  19. .ti -1c
  20. .RI "enum { \fBJulianDayForEpoch\fP = 2440588 }"
  21. .br
  22. .in -1c
  23. .SS "Static Public Member Functions"
  24. .in +1c
  25. .ti -1c
  26. .RI "static QDate \fBminDate\fP ()"
  27. .br
  28. .ti -1c
  29. .RI "static QDate \fBmaxDate\fP ()"
  30. .br
  31. .ti -1c
  32. .RI "static QDateTime \fBtoDateTime\fP (double value, Qt::TimeSpec=Qt::UTC)"
  33. .br
  34. .ti -1c
  35. .RI "static double \fBtoDouble\fP (const QDateTime &)"
  36. .br
  37. .ti -1c
  38. .RI "static QDateTime \fBceil\fP (const QDateTime &, \fBIntervalType\fP)"
  39. .br
  40. .ti -1c
  41. .RI "static QDateTime \fBfloor\fP (const QDateTime &, \fBIntervalType\fP)"
  42. .br
  43. .ti -1c
  44. .RI "static QDate \fBdateOfWeek0\fP (int year, \fBWeek0Type\fP)"
  45. .br
  46. .RI "Date of the first day of the first week for a year\&. "
  47. .ti -1c
  48. .RI "static int \fBweekNumber\fP (const QDate &, \fBWeek0Type\fP)"
  49. .br
  50. .ti -1c
  51. .RI "static int \fButcOffset\fP (const QDateTime &)"
  52. .br
  53. .ti -1c
  54. .RI "static QString \fBtoString\fP (const QDateTime &, const QString &format, \fBWeek0Type\fP)"
  55. .br
  56. .in -1c
  57. .SH "Detailed Description"
  58. .PP
  59. A collection of methods around date/time values\&.
  60. Qt offers convenient classes for dealing with date/time values, but Qwt uses coordinate systems that are based on doubles\&. \fBQwtDate\fP offers methods to translate from QDateTime to double and v\&.v\&.
  61. .PP
  62. A double is interpreted as the number of milliseconds since 1970-01-01T00:00:00 Universal Coordinated Time - also known as 'The Epoch'\&.
  63. .PP
  64. While the range of the Julian day in Qt4 is limited to [0, MAX_INT], Qt5 stores it as qint64 offering a huge range of valid dates\&. As the significance of a double is below this ( assuming a fraction of 52 bits ) the translation is not bijective with rounding errors for dates very far from Epoch\&. For a resolution of 1 ms those start to happen for dates above the year 144683\&.
  65. .PP
  66. An axis for a date/time interval is expected to be aligned and divided in time/date units like seconds, minutes, \&.\&.\&. \fBQwtDate\fP offers several algorithms that are needed to calculate these axes\&.
  67. .PP
  68. \fBSee also\fP
  69. .RS 4
  70. \fBQwtDateScaleEngine\fP, \fBQwtDateScaleDraw\fP, QDate, QTime
  71. .RE
  72. .PP
  73. .SH "Member Enumeration Documentation"
  74. .PP
  75. .SS "anonymous enum"
  76. .PP
  77. \fBEnumerator\fP
  78. .in +1c
  79. .TP
  80. \fB\fIJulianDayForEpoch \fP\fP
  81. The Julian day of 'The Epoch'\&.
  82. .SS "enum \fBQwtDate::IntervalType\fP"
  83. Classification of an time interval
  84. .PP
  85. Time intervals needs to be classified to decide how to align and divide it\&.
  86. .PP
  87. \fBEnumerator\fP
  88. .in +1c
  89. .TP
  90. \fB\fIMillisecond \fP\fP
  91. The interval is related to milliseconds\&.
  92. .TP
  93. \fB\fISecond \fP\fP
  94. The interval is related to seconds\&.
  95. .TP
  96. \fB\fIMinute \fP\fP
  97. The interval is related to minutes\&.
  98. .TP
  99. \fB\fIHour \fP\fP
  100. The interval is related to hours\&.
  101. .TP
  102. \fB\fIDay \fP\fP
  103. The interval is related to days\&.
  104. .TP
  105. \fB\fIWeek \fP\fP
  106. The interval is related to weeks\&.
  107. .TP
  108. \fB\fIMonth \fP\fP
  109. The interval is related to months\&.
  110. .TP
  111. \fB\fIYear \fP\fP
  112. The interval is related to years\&.
  113. .SS "enum \fBQwtDate::Week0Type\fP"
  114. How to identify the first week of year differs between countries\&.
  115. .PP
  116. \fBEnumerator\fP
  117. .in +1c
  118. .TP
  119. \fB\fIFirstThursday \fP\fP
  120. According to ISO 8601 the first week of a year is defined as 'the week with the year's first Thursday in it'\&.
  121. .PP
  122. FirstThursday corresponds to the numbering that is implemented in QDate::weekNumber()\&.
  123. .TP
  124. \fB\fIFirstDay \fP\fP
  125. 'The week with January 1\&.1 in it\&.'
  126. .PP
  127. In the U\&.S\&. this definition is more common than FirstThursday\&.
  128. .SH "Member Function Documentation"
  129. .PP
  130. .SS "QDateTime QwtDate::ceil (const QDateTime & dateTime, \fBIntervalType\fP intervalType)\fC [static]\fP"
  131. Ceil a datetime according the interval type
  132. .PP
  133. \fBParameters\fP
  134. .RS 4
  135. \fIdateTime\fP Datetime value
  136. .br
  137. \fIintervalType\fP Interval type, how to ceil\&. F\&.e\&. when intervalType = QwtDate::Months, the result will be ceiled to the next beginning of a month
  138. .RE
  139. .PP
  140. \fBReturns\fP
  141. .RS 4
  142. Ceiled datetime
  143. .RE
  144. .PP
  145. \fBSee also\fP
  146. .RS 4
  147. \fBfloor()\fP
  148. .RE
  149. .PP
  150. .SS "QDate QwtDate::dateOfWeek0 (int year, \fBWeek0Type\fP type)\fC [static]\fP"
  151. .PP
  152. Date of the first day of the first week for a year\&. The first day of a week depends on the current locale ( QLocale::firstDayOfWeek() )\&.
  153. .PP
  154. \fBParameters\fP
  155. .RS 4
  156. \fIyear\fP Year
  157. .br
  158. \fItype\fP Option how to identify the first week
  159. .RE
  160. .PP
  161. \fBReturns\fP
  162. .RS 4
  163. First day of week 0
  164. .RE
  165. .PP
  166. \fBSee also\fP
  167. .RS 4
  168. QLocale::firstDayOfWeek(), \fBweekNumber()\fP
  169. .RE
  170. .PP
  171. .SS "QDateTime QwtDate::floor (const QDateTime & dateTime, \fBIntervalType\fP intervalType)\fC [static]\fP"
  172. Floor a datetime according the interval type
  173. .PP
  174. \fBParameters\fP
  175. .RS 4
  176. \fIdateTime\fP Datetime value
  177. .br
  178. \fIintervalType\fP Interval type, how to ceil\&. F\&.e\&. when intervalType = QwtDate::Months, the result will be ceiled to the next beginning of a month
  179. .RE
  180. .PP
  181. \fBReturns\fP
  182. .RS 4
  183. Floored datetime
  184. .RE
  185. .PP
  186. \fBSee also\fP
  187. .RS 4
  188. \fBfloor()\fP
  189. .RE
  190. .PP
  191. .SS "QDate QwtDate::maxDate ()\fC [static]\fP"
  192. Maximum for the supported date range
  193. .PP
  194. The range of valid dates depends on how QDate stores the Julian day internally\&.
  195. .PP
  196. .IP "\(bu" 2
  197. For Qt4 it is 'Tue Jun 3 5874898'
  198. .IP "\(bu" 2
  199. For Qt5 it is 'Tue Dec 31 2147483647'
  200. .PP
  201. .PP
  202. \fBReturns\fP
  203. .RS 4
  204. maximum of the date range
  205. .RE
  206. .PP
  207. \fBSee also\fP
  208. .RS 4
  209. \fBminDate()\fP
  210. .RE
  211. .PP
  212. \fBNote\fP
  213. .RS 4
  214. The maximum differs between Qt4 and Qt5
  215. .RE
  216. .PP
  217. .SS "QDate QwtDate::minDate ()\fC [static]\fP"
  218. Minimum for the supported date range
  219. .PP
  220. The range of valid dates depends on how QDate stores the Julian day internally\&.
  221. .PP
  222. .IP "\(bu" 2
  223. For Qt4 it is 'Tue Jan 2 -4713'
  224. .IP "\(bu" 2
  225. For Qt5 it is 'Thu Jan 1 -2147483648'
  226. .PP
  227. .PP
  228. \fBReturns\fP
  229. .RS 4
  230. minimum of the date range
  231. .RE
  232. .PP
  233. \fBSee also\fP
  234. .RS 4
  235. \fBmaxDate()\fP
  236. .RE
  237. .PP
  238. .SS "QDateTime QwtDate::toDateTime (double value, Qt::TimeSpec timeSpec = \fCQt::UTC\fP)\fC [static]\fP"
  239. Translate from double to QDateTime
  240. .PP
  241. \fBParameters\fP
  242. .RS 4
  243. \fIvalue\fP Number of milliseconds since the epoch, 1970-01-01T00:00:00 UTC
  244. .br
  245. \fItimeSpec\fP Time specification
  246. .RE
  247. .PP
  248. \fBReturns\fP
  249. .RS 4
  250. Datetime value
  251. .RE
  252. .PP
  253. \fBSee also\fP
  254. .RS 4
  255. \fBtoDouble()\fP, QDateTime::setMSecsSinceEpoch()
  256. .RE
  257. .PP
  258. \fBNote\fP
  259. .RS 4
  260. The return datetime for Qt::OffsetFromUTC will be Qt::UTC
  261. .RE
  262. .PP
  263. .SS "double QwtDate::toDouble (const QDateTime & dateTime)\fC [static]\fP"
  264. Translate from QDateTime to double
  265. .PP
  266. \fBParameters\fP
  267. .RS 4
  268. \fIdateTime\fP Datetime value
  269. .RE
  270. .PP
  271. \fBReturns\fP
  272. .RS 4
  273. Number of milliseconds since 1970-01-01T00:00:00 UTC has passed\&.
  274. .RE
  275. .PP
  276. \fBSee also\fP
  277. .RS 4
  278. \fBtoDateTime()\fP, QDateTime::toMSecsSinceEpoch()
  279. .RE
  280. .PP
  281. \fBWarning\fP
  282. .RS 4
  283. For values very far below or above 1970-01-01 UTC rounding errors will happen due to the limited significance of a double\&.
  284. .RE
  285. .PP
  286. .SS "QString QwtDate::toString (const QDateTime & dateTime, const QString & format, \fBWeek0Type\fP week0Type)\fC [static]\fP"
  287. Translate a datetime into a string
  288. .PP
  289. Beside the format expressions documented in QDateTime::toString() the following expressions are supported:
  290. .PP
  291. .IP "\(bu" 2
  292. w
  293. .br
  294. week number: ( 1 - 53 )
  295. .IP "\(bu" 2
  296. ww
  297. .br
  298. week number with a leading zero ( 01 - 53 )
  299. .PP
  300. .PP
  301. As week 1 usually starts in the previous year a special rule is applied for formats, where the year is expected to match the week number - even if the date belongs to the previous year\&.
  302. .PP
  303. \fBParameters\fP
  304. .RS 4
  305. \fIdateTime\fP Datetime value
  306. .br
  307. \fIformat\fP Format string
  308. .br
  309. \fIweek0Type\fP Specification of week 0
  310. .RE
  311. .PP
  312. \fBReturns\fP
  313. .RS 4
  314. Datetime string
  315. .RE
  316. .PP
  317. \fBSee also\fP
  318. .RS 4
  319. QDateTime::toString(), \fBweekNumber()\fP, \fBQwtDateScaleDraw\fP
  320. .RE
  321. .PP
  322. .SS "int QwtDate::utcOffset (const QDateTime & dateTime)\fC [static]\fP"
  323. Offset in seconds from Coordinated Universal Time
  324. .PP
  325. The offset depends on the time specification of dateTime:
  326. .PP
  327. .IP "\(bu" 2
  328. Qt::UTC 0, dateTime has no offset
  329. .IP "\(bu" 2
  330. Qt::OffsetFromUTC returns dateTime\&.utcOffset()
  331. .IP "\(bu" 2
  332. Qt::LocalTime: number of seconds from the UTC
  333. .PP
  334. .PP
  335. For Qt::LocalTime the offset depends on the timezone and daylight savings\&.
  336. .PP
  337. \fBParameters\fP
  338. .RS 4
  339. \fIdateTime\fP Datetime value
  340. .RE
  341. .PP
  342. \fBReturns\fP
  343. .RS 4
  344. Offset in seconds
  345. .RE
  346. .PP
  347. .SS "int QwtDate::weekNumber (const QDate & date, \fBWeek0Type\fP type)\fC [static]\fP"
  348. Find the week number of a date
  349. .PP
  350. .IP "\(bu" 2
  351. \fBQwtDate::FirstThursday\fP
  352. .br
  353. Corresponding to ISO 8601 ( see QDate::weekNumber() )\&.
  354. .IP "\(bu" 2
  355. \fBQwtDate::FirstDay\fP
  356. .br
  357. Number of weeks that have begun since \fBdateOfWeek0()\fP\&.
  358. .PP
  359. .PP
  360. \fBParameters\fP
  361. .RS 4
  362. \fIdate\fP Date
  363. .br
  364. \fItype\fP Option how to identify the first week
  365. .RE
  366. .PP
  367. \fBReturns\fP
  368. .RS 4
  369. Week number, starting with 1
  370. .RE
  371. .PP
  372. .SH "Author"
  373. .PP
  374. Generated automatically by Doxygen for Qwt User's Guide from the source code\&.