Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
DateTime.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/StringFwd.h"
6#include "Containers/UnrealString.h"
7#include "CoreTypes.h"
8#include "Misc/Timespan.h"
9#include "Serialization/Archive.h"
10#include "Serialization/StructuredArchive.h"
11#include "Templates/TypeHash.h"
12
13class FArchive;
14class FOutputDevice;
15struct UObject;
16
17
18/**
19 * Enumerates the days of the week in 7-day calendars.
20 */
21enum class EDayOfWeek
22{
23 Monday = 0,
24 Tuesday,
27 Friday,
29 Sunday
30};
31
32
33/**
34 * Enumerates the months of the year in 12-month calendars.
35 */
36enum class EMonthOfYear
37{
38 January = 1,
40 March,
41 April,
42 May,
43 June,
44 July,
45 August,
47 October,
50};
51
52
53/**
54 * Implements a date and time.
55 *
56 * Values of this type represent dates and times between Midnight 00:00:00, January 1, 0001 and
57 * Midnight 23:59:59.9999999, December 31, 9999 in the Gregorian calendar. Internally, the time
58 * values are stored in ticks of 0.1 microseconds (= 100 nanoseconds) since January 1, 0001.
59 *
60 * To retrieve the current local date and time, use the FDateTime.Now() method. To retrieve the
61 * current UTC time, use the FDateTime.UtcNow() method instead.
62 *
63 * This class also provides methods to convert dates and times from and to string representations,
64 * calculate the number of days in a given month and year, check for leap years and determine the
65 * time of day, day of week and month of year of a given date and time.
66 *
67 * The companion struct FTimespan is provided for enabling date and time based arithmetic, such as
68 * calculating the difference between two dates or adding a certain amount of time to a given date.
69 *
70 * Ranges of dates and times can be represented by the FDateRange class.
71 *
72 * @see FDateRange
73 * @see FTimespan
74 */
76{
77public:
78
79 /** Default constructor (zero initialization). */
81 : Ticks(0)
82 { }
83
84 /**
85 * Creates and initializes a new instance with the specified number of ticks.
86 *
87 * @param InTicks The ticks representing the date and time.
88 */
89 FDateTime(int64 InTicks)
90 : Ticks(InTicks)
91 { }
92
93 /**
94 * Creates and initializes a new instance with the specified year, month, day, hour, minute, second and millisecond.
95 *
96 * @param Year The year.
97 * @param Month The month.
98 * @param Day The day.
99 * @param Hour The hour (optional).
100 * @param Minute The minute (optional).
101 * @param Second The second (optional).
102 * @param Millisecond The millisecond (optional).
103 */
104 FDateTime(int32 Year, int32 Month, int32 Day, int32 Hour = 0, int32 Minute = 0, int32 Second = 0, int32 Millisecond = 0);
105
106public:
107
108 /**
109 * Returns result of adding the given time span to this date.
110 *
111 * @return A date whose value is the sum of this date and the given time span.
112 * @see FTimespan
113 */
114 FDateTime operator+(const FTimespan& Other) const
115 {
116 return FDateTime(Ticks + Other.GetTicks());
117 }
118
119 /**
120 * Adds the given time span to this date.
121 *
122 * @return This date.
123 * @see FTimespan
124 */
125 FDateTime& operator+=(const FTimespan& Other)
126 {
127 Ticks += Other.GetTicks();
128
129 return *this;
130 }
131
132 UE_DEPRECATED(5.1, "Adding dates doesn't make sense. Please use FDateTime + FTimespan instead")
134 {
135 return FDateTime(Ticks + Other.Ticks);
136 }
137
138 /**
139 * Returns time span between this date and the given date.
140 *
141 * @return A time span whose value is the difference of this date and the given date.
142 * @see FTimespan
143 */
144 FTimespan operator-(const FDateTime& Other) const
145 {
146 return FTimespan(Ticks - Other.Ticks);
147 }
148
149 /**
150 * Returns result of subtracting the given time span from this date.
151 *
152 * @return A date whose value is the difference of this date and the given time span.
153 * @see FTimespan
154 */
155 FDateTime operator-(const FTimespan& Other) const
156 {
157 return FDateTime(Ticks - Other.GetTicks());
158 }
159
160 /**
161 * Subtracts the given time span from this date.
162 *
163 * @return This date.
164 * @see FTimespan
165 */
166 FDateTime& operator-=(const FTimespan& Other)
167 {
168 Ticks -= Other.GetTicks();
169
170 return *this;
171 }
172
173 /**
174 * Compares this date with the given date for equality.
175 *
176 * @param Other The date to compare with.
177 * @return true if the dates are equal, false otherwise.
178 */
179 bool operator==(const FDateTime& Other) const
180 {
181 return (Ticks == Other.Ticks);
182 }
183
184 /**
185 * Compares this date with the given date for inequality.
186 *
187 * @param Other The date to compare with.
188 * @return true if the dates are not equal, false otherwise.
189 */
190 bool operator!=(const FDateTime& Other) const
191 {
192 return (Ticks != Other.Ticks);
193 }
194
195 /**
196 * Checks whether this date is greater than the given date.
197 *
198 * @param Other The date to compare with.
199 * @return true if this date is greater, false otherwise.
200 */
201 bool operator>(const FDateTime& Other) const
202 {
203 return (Ticks > Other.Ticks);
204 }
205
206 /**
207 * Checks whether this date is greater than or equal to the date span.
208 *
209 * @param Other The date to compare with.
210 * @return true if this date is greater or equal, false otherwise.
211 */
212 bool operator>=(const FDateTime& Other) const
213 {
214 return (Ticks >= Other.Ticks);
215 }
216
217 /**
218 * Checks whether this date is less than the given date.
219 *
220 * @param Other The date to compare with.
221 * @return true if this date is less, false otherwise.
222 */
223 bool operator<(const FDateTime& Other) const
224 {
225 return (Ticks < Other.Ticks);
226 }
227
228 /**
229 * Checks whether this date is less than or equal to the given date.
230 *
231 * @param Other The date to compare with.
232 * @return true if this date is less or equal, false otherwise.
233 */
234 bool operator<=(const FDateTime& Other) const
235 {
236 return (Ticks <= Other.Ticks);
237 }
238
239public:
240
241 /**
242 * Exports the date and time value to a string.
243 *
244 * @param ValueStr Will hold the string value.
245 * @param DefaultValue The default value.
246 * @param Parent Not used.
247 * @param PortFlags Not used.
248 * @param ExportRootScope Not used.
249 * @return true on success, false otherwise.
250 * @see ImportTextItem
251 */
252 bool ExportTextItem(FString& ValueStr, FDateTime const& DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope) const;
253
254 /**
255 * Gets the date part of this date.
256 *
257 * The time part is truncated and becomes 00:00:00.000.
258 *
259 * @return A FDateTime object containing the date.
260 */
262 {
264 }
265
266 /**
267 * Gets the date components of this date.
268 *
269 * @param OutYear Will contain the year.
270 * @param OutMonth Will contain the number of the month (1-12).
271 * @param OutDay Will contain the number of the day (1-31).
272 */
273 void GetDate(int32& OutYear, int32& OutMonth, int32& OutDay) const;
274
275 /**
276 * Gets this date's day part (1 to 31).
277 *
278 * @return Day of the month.
279 * @see GetHour, GetHour12, GetMillisecond, GetMinute, GetMonth, GetSecond, GetYear
280 */
281 int32 GetDay() const;
282
283 /**
284 * Calculates this date's day of the week (Sunday - Saturday).
285 *
286 * @return The week day.
287 * @see GetDayOfYear, GetMonthOfYear, GetTimeOfDay
288 */
290
291 /**
292 * Gets this date's day of the year.
293 *
294 * @return The day of year.
295 * @see GetDayOfWeek, GetMonthOfYear, GetTimeOfDay
296 */
297 int32 GetDayOfYear() const;
298
299 /**
300 * Gets this date's hour part in 24-hour clock format (0 to 23).
301 *
302 * @return The hour.
303 * @see GetDay, GetDayOfWeek, GetDayOfYear, GetHour12, GetMillisecond, GetMinute, GetMonth, GetSecond, GetYear
304 */
305 int32 GetHour() const
306 {
307 return (int32)((Ticks / ETimespan::TicksPerHour) % 24);
308 }
309
310 /**
311 * Gets this date's hour part in 12-hour clock format (1 to 12).
312 *
313 * @return The hour in AM/PM format.
314 * @see GetDay, GetHour, GetMillisecond, GetMinute, GetMonth, GetSecond, GetYear
315 */
316 int32 GetHour12() const;
317
318 /**
319 * Returns the Julian Day for this date.
320 *
321 * The Julian Day is the number of days since the inception of the Julian calendar at noon on
322 * Monday, January 1, 4713 B.C.E. The minimum Julian Day that can be represented in FDateTime is
323 * 1721425.5, which corresponds to Monday, January 1, 0001 in the Gregorian calendar.
324 *
325 * @return Julian Day.
326 * @see FromJulianDay, GetModifiedJulianDay
327 */
328 double GetJulianDay() const
329 {
330 return 1721425.5 + double(Ticks / ETimespan::TicksPerDay) + GetTimeOfDay().GetTotalDays();
331 }
332
333 /**
334 * Returns the Modified Julian day.
335 *
336 * The Modified Julian Day is calculated by subtracting 2400000.5, which corresponds to midnight UTC on
337 * November 17, 1858 in the Gregorian calendar.
338 *
339 * @return Modified Julian Day
340 * @see GetJulianDay
341 */
342 double GetModifiedJulianDay() const
343 {
344 return (GetJulianDay() - 2400000.5);
345 }
346
347 /**
348 * Gets this date's millisecond part (0 to 999).
349 *
350 * @return The millisecond.
351 * @see GetDay, GetHour, GetHour12, GetMinute, GetMonth, GetSecond, GetYear
352 */
353 int32 GetMillisecond() const
354 {
355 return (int32)((Ticks / ETimespan::TicksPerMillisecond) % 1000);
356 }
357
358 /**
359 * Gets this date's minute part (0 to 59).
360 *
361 * @return The minute.
362 * @see GetDay, GetHour, GetHour12, GetMillisecond, GetMonth, GetSecond, GetYear
363 */
364 int32 GetMinute() const
365 {
366 return (int32)((Ticks / ETimespan::TicksPerMinute) % 60);
367 }
368
369 /**
370 * Gets this date's the month part (1 to 12).
371 *
372 * @return The month.
373 * @see GetDay, GetHour, GetHour12, GetMillisecond, GetMinute, GetSecond, GetYear
374 */
375 int32 GetMonth() const;
376
377 /**
378 * Gets the date's month of the year (January to December).
379 *
380 * @return Month of year.
381 * @see GetDayOfWeek, GetDayOfYear, GetTimeOfDay
382 */
384 {
385 return static_cast<EMonthOfYear>(GetMonth());
386 }
387
388 /**
389 * Gets this date's second part.
390 *
391 * @return The second.
392 * @see GetDay, GetHour, GetHour12, GetMillisecond, GetMinute, GetMonth, GetYear
393 */
394 int32 GetSecond() const
395 {
396 return (int32)((Ticks / ETimespan::TicksPerSecond) % 60);
397 }
398
399 /**
400 * Gets this date's representation as number of ticks.
401 *
402 * @return Number of ticks since midnight, January 1, 0001.
403 */
404 int64 GetTicks() const
405 {
406 return Ticks;
407 }
408
409 /**
410 * Gets the time elapsed since midnight of this date.
411 *
412 * @return Time of day since midnight.
413 * @see GetDayOfWeek, GetDayOfYear, GetMonthOfYear
414 */
416 {
418 }
419
420 /**
421 * Gets this date's year part.
422 *
423 * @return The year.
424 * @see GetDay, GetHour, GetHour12, GetMillisecond, GetMinute, GetMonth, GetSecond
425 */
426 int32 GetYear() const;
427
428 /**
429 * Imports a date and time value from a text buffer.
430 *
431 * @param Buffer The text buffer to import from.
432 * @param PortFlags Not used.
433 * @param Parent Not used.
434 * @param ErrorText The output device for error logging.
435 * @return true on success, false otherwise.
436 * @see ExportTextItem
437 */
438 bool ImportTextItem(const TCHAR*& Buffer, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText);
439
440 /**
441 * Gets whether this date's time is in the afternoon.
442 *
443 * @return true if it is in the afternoon, false otherwise.
444 * @see IsMorning
445 */
446 bool IsAfternoon() const
447 {
448 return (GetHour() >= 12);
449 }
450
451 /**
452 * Gets whether this date's time is in the morning.
453 *
454 * @return true if it is in the morning, false otherwise.
455 * @see IsAfternoon
456 */
457 bool IsMorning() const
458 {
459 return (GetHour() < 12);
460 }
461
462 /**
463 * Serializes this date and time from or into the specified archive.
464 *
465 * @param Ar The archive to serialize from or into.
466 * @return true on success, false otherwise.
467 */
469
470 /**
471 * Serializes this date and time for network transmission
472 */
473 bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess);
474
475 /**
476 * Returns the RFC 1123 string representation of the FDateTime.
477 *
478 * The resulting string assumes that the FDateTime is in UTC.
479 *
480 * @return String representation.
481 * @see ParseHttpDate, ToIso8601, ToString
482 */
484
485 /**
486 * Returns the ISO-8601 string representation of the FDateTime.
487 *
488 * The resulting string assumes that the FDateTime is in UTC.
489 *
490 * @return String representation.
491 * @see ParseIso8601, ToHttpDate, ToString
492 */
494
495 /**
496 * Returns the string representation of this date using a default format.
497 *
498 * The returned string has the following format:
499 * yyyy.mm.dd-hh.mm.ss
500 *
501 * @return String representation.
502 * @see Parse, ToIso8601
503 */
505
506 /**
507 * Returns the string representation of this date.
508 *
509 * ToString uses a non-standard format syntax (see below). If you need strftime-like syntax, then use ToFormattedString:
510 * %a - am or pm
511 * %A - AM or PM
512 * %d - Day, 01-31
513 * %D - Day of the Year, 001-366
514 * %m - Month, 01-12
515 * %y - Year, YY
516 * %Y - Year, YYYY
517 * %h - 12h Hour, 01-12
518 * %H - 24h Hour, 00-23
519 * %M - Minute, 00-59
520 * %S - Second, 00-60
521 * %s - Millisecond, 000-999
522 *
523 * @param Format The format of the returned string.
524 * @return String representation.
525 * @see Parse, ToIso8601
526 */
527 FString ToString(const TCHAR* Format) const;
528 void ToString(const TCHAR* Format, FStringBuilderBase& Result) const;
529
530 /**
531 * Returns the string representation of this date.
532 *
533 * Uses strftime-like syntax:
534 * %a - Weekday, eg) Sun
535 * %A - Weekday, eg) Sunday
536 * %w - Weekday, 0-6 (Sunday is 0)
537 * %y - Year, YY
538 * %Y - Year, YYYY
539 * %b - Month, eg) Jan
540 * %B - Month, eg) January
541 * %m - Month, 01-12
542 * %d - Day, 01-31
543 * %e - Day, 1-31
544 * %l - 12h Hour, 1-12
545 * %I - 12h Hour, 01-12
546 * %H - 24h Hour, 00-23
547 * %M - Minute, 00-59
548 * %S - Second, 00-60
549 * %p - AM or PM
550 * %P - am or PM
551 * %j - Day of the Year, 001-366
552 *
553 * @param Format The format of the returned string.
554 * @return String representation.
555 */
556 FString ToFormattedString(const TCHAR* Format) const;
557
558 /**
559 * Returns this date as the number of seconds since the Unix Epoch (January 1st of 1970).
560 *
561 * @return Time of day.
562 * @see FromUnixTimestamp
563 */
564 int64 ToUnixTimestamp() const
565 {
567 }
568
569public:
570
571 /**
572 * Gets the number of days in the year and month.
573 *
574 * @param Year The year.
575 * @param Month The month.
576 * @return The number of days
577 * @see DaysInYear
578 */
579 static int32 DaysInMonth(int32 Year, int32 Month);
580
581 /**
582 * Gets the number of days in the given year.
583 *
584 * @param Year The year.
585 * @return The number of days.
586 * @see DaysInMonth
587 */
588 static int32 DaysInYear(int32 Year);
589
590 /**
591 * Returns the proleptic Gregorian date for the given Julian Day.
592 *
593 * @param JulianDay The Julian Day.
594 * @return Gregorian date and time.
595 * @see GetJulianDay
596 */
597 static FDateTime FromJulianDay(double JulianDay)
598 {
599 return FDateTime((int64)((JulianDay - 1721425.5) * ETimespan::TicksPerDay));
600 }
601
602 /**
603 * Returns the date from Unix time (seconds from midnight 1970-01-01)
604 *
605 * @param UnixTime Unix time (seconds from midnight 1970-01-01)
606 * @return Gregorian date and time.
607 * @see ToUnixTimestamp
608 */
609 static FDateTime FromUnixTimestamp(int64 UnixTime)
610 {
611 return FDateTime(1970, 1, 1) + FTimespan(UnixTime * ETimespan::TicksPerSecond);
612 }
613
614 /**
615 * Checks whether the given year is a leap year.
616 *
617 * A leap year is a year containing one additional day in order to keep the calendar synchronized
618 * with the astronomical year. All years divisible by 4, but not divisible by 100 - except if they
619 * are also divisible by 400 - are leap years.
620 *
621 * @param Year The year to check.
622 * @return true if the year is a leap year, false otherwise.
623 */
624 static bool IsLeapYear(int32 Year);
625
626 /**
627 * Returns the maximum date value.
628 *
629 * The maximum date value is December 31, 9999, 23:59:59.9999999.
630 *
631 * @see MinValue
632 */
634 {
635 return FDateTime(3652059 * ETimespan::TicksPerDay - 1);
636 }
637
638 /**
639 * Returns the minimum date value.
640 *
641 * The minimum date value is January 1, 0001, 00:00:00.0.
642 *
643 * @see MaxValue
644 */
646 {
647 return FDateTime(0);
648 }
649
650 /**
651 * Gets the local date and time on this computer.
652 *
653 * This method takes into account the local computer's time zone and daylight saving
654 * settings. For time zone independent time comparisons, and when comparing times
655 * between different computers, please use UtcNow() instead.
656 *
657 * @return Current date and time.
658 * @see Today, UtcNow
659 */
660 static FDateTime Now();
661
662 /**
663 * Converts a string to a date and time.
664 *
665 * Currently, the string must be in the format written by either FDateTime.ToString() or
666 * FTimeStamp.TimestampToFString(). Other formats are not supported at this time.
667 *
668 * @param DateTimeString The string to convert.
669 * @param OutDateTime Will contain the parsed date and time.
670 * @return true if the string was converted successfully, false otherwise.
671 * @see ParseHttpDate, ParseIso8601, ToString
672 */
673 static bool Parse(const FString& DateTimeString, FDateTime& OutDateTime);
674
675 /**
676 * Parses a date string in HTTP-date format (rfc1123-date | rfc850-date | asctime-date)
677 * https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
678 *
679 * HTTP-date = rfc1123-date | rfc850-date | asctime-date
680 * rfc1123-date = wkday "," SP date1 SP time SP "GMT"
681 * rfc850-date = weekday "," SP date2 SP time SP "GMT"
682 * asctime-date = wkday SP date3 SP time SP 4DIGIT
683 * date1 = 2DIGIT SP month SP 4DIGIT ; day month year (e.g., 02 Jun 1982)
684 * date2 = 2DIGIT "-" month "-" 2DIGIT ; day-month-year (e.g., 02-Jun-82)
685 * date3 = month SP (2DIGIT | (SP 1DIGIT)) ; month day (e.g., Jun 2)
686 * time = 2DIGIT ":" 2DIGIT ":" 2DIGIT ; 00:00:00 - 23:59:59
687 * wkday = "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun"
688 * weekday = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"
689 * month = "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" | "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"
690 *
691 * @param HttpDate The string to be parsed
692 * @param OutDateTime FDateTime object (assumes UTC) corresponding to the input string.
693 * @return true if the string was converted successfully, false otherwise.
694 * @see Parse, ToHttpDate, ParseIso8601
695 */
696 static bool ParseHttpDate(const FString& HttpDate, FDateTime& OutDateTime);
697
698 /**
699 * Parses a date string in ISO-8601 format.
700 *
701 * @param DateTimeString The string to be parsed
702 * @param OutDateTime FDateTime object (in UTC) corresponding to the input string (which may have been in any timezone).
703 * @return true if the string was converted successfully, false otherwise.
704 * @see Parse, ParseHttpDate, ToIso8601
705 */
706 static bool ParseIso8601(const TCHAR* DateTimeString, FDateTime& OutDateTime);
707
708 /**
709 * Gets the local date on this computer.
710 *
711 * The time component is set to 00:00:00
712 *
713 * @return Current date.
714 * @see Now, UtcNow
715 */
717 {
718 return Now().GetDate();
719 }
720
721 /**
722 * Gets the UTC date and time on this computer.
723 *
724 * This method returns the Coordinated Universal Time (UTC), which does not take the
725 * local computer's time zone and daylight savings settings into account. It should be
726 * used when comparing dates and times that should be independent of the user's locale.
727 * To get the date and time in the current locale, use Now() instead.
728 *
729 * This method will use an estimate if USE_ESTIMATED_UTCNOW is 1. To calculate the
730 * estimate it will initialize a base reference time and keep track of the offset from
731 * that time with FPlatformTime::Cycles64().
732 * This is appropriate for platforms whose implementations of FPlatformTime::UtcTime
733 * are expensive. To use, enable bUseEstimatedUtcNow in TargetRules. The rebase time
734 * is stored in time.EstimatedUtcNowRebaseTimeSeconds (default setting is 600 seconds).
735 *
736 * @return Current date and time.
737 * @see Now
738 */
740
741 /**
742 * Validates the given components of a date and time value.
743 *
744 * The allow ranges for the components are:
745 * Year: 1 - 9999
746 * Month: 1 - 12
747 * Day: 1 - DaysInMonth(Month)
748 * Hour: 0 - 23
749 * Minute: 0 - 59
750 * Second: 0 - 59
751 * Millisecond: 0 - 999
752 *
753 * @return true if the components are valid, false otherwise.
754 */
755 static bool Validate(int32 Year, int32 Month, int32 Day, int32 Hour, int32 Minute, int32 Second, int32 Millisecond);
756
757public:
758
759 /**
760 * Serializes the given date and time from or into the specified archive.
761 *
762 * @param Ar The archive to serialize from or into.
763 * @param DateTime The date and time value to serialize.
764 * @return The archive.
765 */
766 friend FArchive& operator<<(FArchive& Ar, FDateTime& DateTime)
767 {
768 return Ar << DateTime.Ticks;
769 }
770
771 /**
772 * Serializes the given date and time from or into the specified structured archive slot.
773 *
774 * @param Slot The structured archive slot to serialize from or into.
775 * @param DateTime The date and time value to serialize.
776 */
777 friend void operator<<(FStructuredArchive::FSlot Slot, FDateTime& DateTime)
778 {
779 return Slot << DateTime.Ticks;
780 }
781
782 /**
783 * Gets the hash for the specified date and time.
784 *
785 * @param DateTime The date and time to get the hash for.
786 * @return Hash value.
787 */
788 friend uint32 GetTypeHash(const FDateTime& DateTime)
789 {
790 return GetTypeHash(DateTime.Ticks);
791 }
792
793protected:
794
795 /** Holds the days per month in a non-leap year. */
796 static const int32 DaysPerMonth[];
797
798 /** Holds the cumulative days per month in a non-leap year. */
799 static const int32 DaysToMonth[];
800
801 /** Holds the long and short day names. */
802 static const TCHAR* ShortDayNames[];
803 static const TCHAR* LongDayNames[];
804
805 /** Holds the long and short month names. */
806 static const TCHAR* ShortMonthNames[];
807 static const TCHAR* LongMonthNames[];
808
809private:
810 friend struct Z_Construct_UScriptStruct_FDateTime_Statics;
811
812private:
813
814 /** Holds the ticks in 100 nanoseconds resolution since January 1, 0001 A.D. */
815 int64 Ticks;
816};
#define UE_DEPRECATED(Version, Message)
EMonthOfYear
Definition Enums.h:13096
EDayOfWeek
Definition Enums.h:13390
constexpr int64 TicksPerDay
Definition Timespan.h:32
constexpr int64 TicksPerMillisecond
Definition Timespan.h:41
constexpr int64 TicksPerMinute
Definition Timespan.h:44
constexpr int64 TicksPerHour
Definition Timespan.h:35
constexpr int64 TicksPerSecond
Definition Timespan.h:47
void GetDate(int32 &OutYear, int32 &OutMonth, int32 &OutDay) const
static FDateTime Now()
static FDateTime MaxValue()
Definition DateTime.h:633
int64 GetTicks() const
Definition DateTime.h:404
FDateTime GetDate() const
Definition DateTime.h:261
double GetModifiedJulianDay() const
Definition DateTime.h:342
static bool ParseIso8601(const TCHAR *DateTimeString, FDateTime &OutDateTime)
FString ToString() const
bool operator<=(const FDateTime &Other) const
Definition DateTime.h:234
int32 GetMinute() const
Definition DateTime.h:364
FDateTime()
Definition DateTime.h:80
FDateTime & operator-=(const FTimespan &Other)
Definition DateTime.h:166
FString ToIso8601() const
void ToString(const TCHAR *Format, FStringBuilderBase &Result) const
double GetJulianDay() const
Definition DateTime.h:328
FString ToFormattedString(const TCHAR *Format) const
bool Serialize(FArchive &Ar)
bool operator>=(const FDateTime &Other) const
Definition DateTime.h:212
FDateTime & operator+=(const FTimespan &Other)
Definition DateTime.h:125
static int32 DaysInMonth(int32 Year, int32 Month)
static bool ParseHttpDate(const FString &HttpDate, FDateTime &OutDateTime)
int32 GetYear() const
friend uint32 GetTypeHash(const FDateTime &DateTime)
Definition DateTime.h:788
int64 Ticks
Definition DateTime.h:815
bool operator!=(const FDateTime &Other) const
Definition DateTime.h:190
EMonthOfYear GetMonthOfYear() const
Definition DateTime.h:383
static FDateTime UtcNow()
bool NetSerialize(FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
FTimespan GetTimeOfDay() const
Definition DateTime.h:415
int32 GetDay() const
FString ToString(const TCHAR *Format) const
int64 ToUnixTimestamp() const
Definition DateTime.h:564
static bool Validate(int32 Year, int32 Month, int32 Day, int32 Hour, int32 Minute, int32 Second, int32 Millisecond)
FDateTime operator-(const FTimespan &Other) const
Definition DateTime.h:155
int32 GetMonth() const
int32 GetHour12() const
bool operator<(const FDateTime &Other) const
Definition DateTime.h:223
bool ExportTextItem(FString &ValueStr, FDateTime const &DefaultValue, UObject *Parent, int32 PortFlags, UObject *ExportRootScope) const
bool ImportTextItem(const TCHAR *&Buffer, int32 PortFlags, UObject *Parent, FOutputDevice *ErrorText)
static const int32 DaysToMonth[]
Definition DateTime.h:799
static bool Parse(const FString &DateTimeString, FDateTime &OutDateTime)
FDateTime(int64 InTicks)
Definition DateTime.h:89
static const TCHAR * LongDayNames[]
Definition DateTime.h:803
static FDateTime MinValue()
Definition DateTime.h:645
int32 GetMillisecond() const
Definition DateTime.h:353
int32 GetDayOfYear() const
int32 GetHour() const
Definition DateTime.h:305
bool operator>(const FDateTime &Other) const
Definition DateTime.h:201
static FDateTime FromUnixTimestamp(int64 UnixTime)
Definition DateTime.h:609
static FDateTime FromJulianDay(double JulianDay)
Definition DateTime.h:597
FString ToHttpDate() const
bool IsMorning() const
Definition DateTime.h:457
FTimespan operator-(const FDateTime &Other) const
Definition DateTime.h:144
static const int32 DaysPerMonth[]
Definition DateTime.h:796
static const TCHAR * ShortDayNames[]
Definition DateTime.h:802
EDayOfWeek GetDayOfWeek() const
bool operator==(const FDateTime &Other) const
Definition DateTime.h:179
static FDateTime Today()
Definition DateTime.h:716
static int32 DaysInYear(int32 Year)
FDateTime operator+(const FTimespan &Other) const
Definition DateTime.h:114
FDateTime(int32 Year, int32 Month, int32 Day, int32 Hour=0, int32 Minute=0, int32 Second=0, int32 Millisecond=0)
friend void operator<<(FStructuredArchive::FSlot Slot, FDateTime &DateTime)
Definition DateTime.h:777
bool IsAfternoon() const
Definition DateTime.h:446
static const TCHAR * LongMonthNames[]
Definition DateTime.h:807
static bool IsLeapYear(int32 Year)
FDateTime operator+(const FDateTime &Other)
Definition DateTime.h:133
static const TCHAR * ShortMonthNames[]
Definition DateTime.h:806
int32 GetSecond() const
Definition DateTime.h:394
int64 GetTicks() const
Definition Timespan.h:454
double GetTotalDays() const
Definition Timespan.h:465
FTimespan(int64 InTicks)
Definition Timespan.h:92
Definition UE.h:432