DateTime as UTC Only

I’m currently messing around with the engine and wanted to create a small blueprint that handles the date and time in game. I want to work out the date and time based on a static start date + however long the game/server has been running.

I have this working, but because of the timezone my time is not what I want.

Basically I have a DateTime variable in which I specify a static date (example: 2017.01.01 09.00.00 +0200), but it will automatically add +0200 at the end since that is the timezone I’m in. This means that the time I show on the HUD is off by 2 hours compared to what I set the variable.

There is a function that will return the date and time as UTC as Text, but I want a DateTime object as UTC and not a string/text representation so I can do calculations on the UTC date and time.

I don’t care about the local time in this case. I just want to be able to set a DateTime variable to a specific date without it automatically being convert to my local timezone.

I assume this is simple in C++, but how do you do it in blueprints?

Regards

Engine\Source\Editor\DetailCustomizations\Private\DateTimeStructCustomization.cpp

FDateTimeStructCustomization::ParseDateTimeZone(const FString& DateTimeZoneString, FDateTime& OutDateTime)

In this method, hardcoded timezone. I have no idea why an arbitrary structure is tied to local time.

if you do not use UPROPERTY(BlueprintReadWrite) of this structure, but declare it in c ++, then the DateTimeStructCustomization methods do not work and the structure can be used normally without a timezone.

you just need it not to be configured directly in the editor.
I think this is a BUG.

There is any way to use this functions in C++? I’m not sure how to import it.

There are global functions called Now() and UtcNow(), would either of these help you?

I just hit this problem and am posting a fix for those who follow. There is an editor option called “Display Timezone” - if you set this to UTC it will zero out the time zone value.