x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 Nick

Product Version: UE 4.15
Tags:
more ▼

asked Apr 16 '17 at 11:28 AM in Blueprint Scripting

avatar image

Nic_s
26 1 2 5

avatar image Sn_a_ke Nov 25 '18 at 09:13 PM

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.

avatar image Cucharón Dec 27 '18 at 01:53 PM

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

avatar image Clampy Dec 27 '18 at 07:08 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question