Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Misc/DateTime.h |
Include |
#include "Misc/DateTime.h" |
struct FDateTime
Implements a date and time.
Values of this type represent dates and times between Midnight 00:00:00, January 1, 0001 and Midnight 23:59:59.9999999, December 31, 9999 in the Gregorian calendar. Internally, the time values are stored in ticks of 0.1 microseconds (= 100 nanoseconds) since January 1, 0001.
To retrieve the current local date and time, use the FDateTime.Now() method. To retrieve the current UTC time, use the FDateTime.UtcNow() method instead.
This class also provides methods to convert dates and times from and to string representations, calculate the number of days in a given month and year, check for leap years and determine the time of day, day of week and month of year of a given date and time.
The companion struct FTimespan is provided for enabling date and time based arithmetic, such as calculating the difference between two dates or adding a certain amount of time to a given date.
Ranges of dates and times can be represented by the FDateRange class.
Name | Description | |
---|---|---|
|
FDateTime() |
Default constructor (zero initialization). |
|
FDateTime ( |
Creates and initializes a new instance with the specified number of ticks. |
|
FDateTime ( |
Creates and initializes a new instance with the specified year, month, day, hour, minute, second and millisecond. |
Name | Description | ||
---|---|---|---|
|
int32 |
DaysInMonth ( |
Gets the number of days in the year and month. |
|
int32 |
DaysInYear ( |
Gets the number of days in the given year. |
|
bool |
ExportTextItem |
Exports the date and time value to a string. |
|
FromJulianDay ( |
Returns the proleptic Gregorian date for the given Julian Day. |
|
|
FromUnixTimestamp ( |
Returns the date from Unix time (seconds from midnight 1970-01-01) |
|
|
FromUnixTimestampDecimal ( |
Returns the date from Unix time (seconds from midnight 1970-01-01) |
|
|
void |
GetDate ( |
Gets the date components of this date. |
|
GetDate() |
Gets the date part of this date. The time part is truncated and becomes 00:00:00.000. |
|
|
int32 |
GetDay() |
Gets this date's day part (1 to 31). |
|
EDayOfWeek |
GetDayOfWeek() |
Calculates this date's day of the week (Sunday - Saturday). |
|
int32 |
GetDayOfYear() |
Gets this date's day of the year. |
|
int32 |
GetHour() |
Gets this date's hour part in 24-hour clock format (0 to 23). |
|
int32 |
GetHour12() |
Gets this date's hour part in 12-hour clock format (1 to 12). |
|
double |
GetJulianDay() |
Returns the Julian Day for this date. |
|
int32 |
GetMillisecond() |
Gets this date's millisecond part (0 to 999). |
|
int32 |
GetMinute() |
Gets this date's minute part (0 to 59). |
|
double |
GetModifiedJulianDay() |
Returns the Modified Julian day. |
|
int32 |
GetMonth() |
Gets this date's the month part (1 to 12). |
|
EMonthOfYear |
GetMonthOfYear() |
Gets the date's month of the year (January to December). |
|
int32 |
GetSecond() |
Gets this date's second part. |
|
int64 |
GetTicks() |
Gets this date's representation as number of ticks. |
|
GetTimeOfDay() |
Gets the time elapsed since midnight of this date. |
|
|
int32 |
GetYear() |
Gets this date's year part. |
|
bool |
ImportTextItem ( |
Imports a date and time value from a text buffer. |
|
bool |
IsAfternoon() |
Gets whether this date's time is in the afternoon. |
|
bool |
IsLeapYear ( |
Checks whether the given year is a leap year. |
|
bool |
IsMorning() |
Gets whether this date's time is in the morning. |
|
MaxValue() |
Returns the maximum date value. The maximum date value is December 31, 9999, 23:59:59.9999999. |
|
|
MinValue() |
Returns the minimum date value. The minimum date value is January 1, 0001, 00:00:00.0. |
|
|
bool |
NetSerialize ( |
Serializes this date and time for network transmission |
|
Now() |
Gets the local date and time on this computer. |
|
|
bool |
Parse |
Converts a string to a date and time. |
|
bool |
ParseHttpDate |
Parses a date string in HTTP-date format (rfc1123-date | rfc850-date | asctime-date) https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 |
|
bool |
ParseIso8601 ( |
Parses a date string in ISO-8601 format. |
|
bool |
Serialize ( |
Serializes this date and time from or into the specified archive. |
|
Today() |
Gets the local date on this computer. The time component is set to 00:00:00 |
|
|
ToFormattedString ( |
Returns the string representation of this date. |
|
|
ToHttpDate() |
Returns the RFC 1123 string representation of the FDateTime. |
|
|
ToIso8601() |
Returns the ISO-8601 string representation of the FDateTime. |
|
|
ToString ( |
Returns the string representation of this date. |
|
|
ToString() |
Returns the string representation of this date using a default format. |
|
|
void |
ToString ( |
Returns the string representation of this date using a default format. |
|
int64 |
ToUnixTimestamp() |
Returns this date as the number of seconds since the Unix Epoch (January 1st of 1970). |
|
double |
ToUnixTimestampDecimal() |
Returns this date as the number of seconds since the Unix Epoch (January 1st of 1970). |
|
UtcNow() |
Gets the UTC date and time on this computer. |
|
|
bool |
Validate ( |
Validates the given components of a date and time value. |
Name | Description | ||
---|---|---|---|
|
operator- ( |
Returns result of subtracting the given time span from this date. |
|
|
operator- ( |
Returns time span between this date and the given date. |
|
|
bool |
operator!= ( |
Compares this date with the given date for inequality. |
|
operator+ ( |
Returns result of adding the given time span to this date. |
|
|
operator+= ( |
Adds the given time span to this date. |
|
|
bool |
operator< ( |
Checks whether this date is less than the given date. |
|
bool |
operator<= ( |
Checks whether this date is less than or equal to the given date. |
|
operator-= ( |
Subtracts the given time span from this date. |
|
|
bool |
operator== ( |
Compares this date with the given date for equality. |
|
bool |
operator> ( |
Checks whether this date is greater than the given date. |
|
bool |
operator>= ( |
Checks whether this date is greater than or equal to the date span. |
Name |
Description |
---|---|
DaysPerMonth |
Holds the days per month in a non-leap year. |
DaysToMonth |
Holds the cumulative days per month in a non-leap year. |
LongDayNames |
|
LongMonthNames |
|
ShortDayNames |
Holds the long and short day names. |
ShortMonthNames |
Holds the long and short month names. |