读取系统时间和时间戳【UE4】【C++】

	FDateTime Time = FDateTime::Now();
	//获取时间戳
	int64 Timestamp = Time.ToUnixTimestamp();
	UE_LOG(LogTemp, Warning, TEXT("%d"), Timestamp);

将 Unix Timestamp 转换为年月日(year, month, day)

FDateTime Time = FDateTime::FromUnixTimestamp(int64 UnixTime);

获取系统当前日期时间:年月日时分秒

int64 Timestamp = Time.ToUnixTimestamp();
	UE_LOG(LogTemp, Warning, TEXT("%d"), Timestamp);
	int year = Time.GetYear();
	int month = Time.GetMonth();
	int day = Time.GetDay();
	int hour = Time.GetHour();
	int minute = Time.GetMinute();
	int second = Time.GetSecond();
	UE_LOG(LogTemp, Warning, TEXT("时间:%d, %d, %d, %d, %d, %d"), year, month, day, hour, minute, second);

读取系统时间和时间戳【UE4】【C++】_第1张图片

你可能感兴趣的:(C++)