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"

How to set default value of DateTime Struct?

I'm trying to set the default value of a DateTime Struct, but that's not possible. The default default value is "0001.01.01-00.00.00" and if I change it to "2000.01.01-00.00.00" and hit Compile, it changes back to "0001.01.01-00.00.00". Unfortunately I also can't find any node for directly setting the DateTime value. I don't care how, I just want to set this Date once to the date I need it to be, if you have any idea I would appreciate some hints how to do this

Product Version: Not Selected
Tags:
more ▼

asked Feb 16 '15 at 08:59 PM in Bug Reports

avatar image

John Alcatraz
1.3k 60 139 127

avatar image Martin Egger Feb 16 '15 at 09:10 PM

Hey

Which version are you working in?

avatar image John Alcatraz Feb 16 '15 at 09:11 PM

4.6.1, the last stable version

avatar image Martin Egger Feb 16 '15 at 09:50 PM

So I have a similar experience as you do. During my time searching why that is I found this on AnswerHub where someone describes in a fashion how to manipulate DateTime https://answers.unrealengine.com/questions/124364/keeping-track-of-playtime.html

Hope it helps otherwise I would need to know what you would like to achieve by setting this to a higher value.

Best

avatar image John Alcatraz Feb 16 '15 at 10:29 PM

I know this way to manipulate the DateTime, but it does only work for short periods of time. I need to set my time to something like January 1. 1200, it's a medieval game and I want to show the Date :)

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

1 answer: sort voted first

Hi John Alcatraz,

This issue just popped up in my list, so I'm not sure how it was overlooked but I apologize.

Testing this in 4.7.3, it appears to no longer be an issue. I'm able to set the default of a variable of type DateTime within the struct.

To update a struct value, use the "Set members in StructName" node, where "StructName" is the name of your structure. You can then get a reference to the Struct and set its DateTime member variable with a DateTime variable in the BP. Currently, there's a bug in 4.7.3 that does crashes the editor if there's a DateTime variable in a Blueprint, but it's integrated into 4.7.4 (and should be available in the latest 4.7 branch if you're building from GitHub).

Hope that helps!

more ▼

answered Mar 23 '15 at 07:22 PM

avatar image John Alcatraz Mar 23 '15 at 07:44 PM

You don't have to apologize, I just moved this question to Bug Reports recently ;) Actually I don't get what you want to say with "To update a struct value, use the "Set members in StructName" node, where "StructName" is the name of your structure". There is no "Set members in DateTime" or am I blind?

avatar image Ben Halliday STAFF Mar 23 '15 at 07:56 PM

It will be the name of your struct instead of "DateTime." So if your struct with the DateTime variable is named "DateTimeStruct," you would search for the node called, "Set members in DateTimeStruct." If you search only for "Set members in" in the context menu, you should see every struct in your project show up as an option and you can simply select the correct one.

alt text

It's possible you'll need to compile/save the struct again before it shows up in the menu. I'm not sure whether that's a bug or I just forgot to do it, but that happened to me once. I'll be looking into that separately.

avatar image John Alcatraz Mar 23 '15 at 07:57 PM

I have no struct, why do you think I have a struct? I am just talking about a single DateTime variable, which is itself a struct. My question is how to set a single DateTime variable.

avatar image Ben Halliday STAFF Mar 23 '15 at 08:18 PM

I'm sorry, I was thrown off by your terminology. We usually refer to the DateTime Structure variables as DateTime variables, so I assumed you made a Struct using DateTime variables.

I'm looking into this now. The build I had from GitHub was old and the fix for the DateTime variable crash wasn't included, so it'll take a bit to build current. I'll let you know how to set this up once I have everything up to date.

avatar image Ben Halliday STAFF Mar 23 '15 at 09:27 PM

Okay, just double checked in the latest 4.7, and setting the default for a DateTime variable does work (it doesn't reset when compiling), and having one in your BP no longer crashes the editor. As for setting one during runtime, it looks like that's not actually possible. I'm going to enter a feature request for that, and I'll let you know what the developers say when they get to it.

avatar image John Alcatraz Mar 28 '15 at 11:24 PM

Unfortunately it is NOT fixed. I am using the 4.7 branch from github (some days old, 4.7.3 + 11 commits) and I can use DateTime variables without crashes. I set it to "1100.01.01-00.00.00" default value (medieval game). Then i start the game and print it out. And unfortunately I get " Aug 12, 1916" which is not very medieval.

avatar image Ben Halliday STAFF Mar 30 '15 at 06:38 PM

Ah, okay, that looks like a separate issue. FDateTime isn't correctly formatted by the string converter when using any dates before January 1st, 1970, so using the As Date Time nodes to print the DateTime variable won't work for anything before then. The ICU based string formatter converts the FDateTime to a unix timestamp, which is then formatted as a string. January 1st 1970, is when the Unix epoch starts, thus the limitation.

I've entered a bug report for that (UE-13006) and I'll let you know when I see an update. Thanks for the report!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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