Hey guys!
For my program i need the current week number of the year. I looked in FDateTime:: but there is nothing in there that can help.
I see alot of c++ syntax on the web but not suitable for ue4.
Any one know how to do this?
With kind regards
Alex
Hi, I needed this too and I have created a simple Blueprint to Calculate the current ISO-8601 week of the year. It could easily be done in C++ using the FDateTime Library. (I will post when I do it). My tests show it to work going forward and for the past decade.
-
Need to Calc the Day of the Week - I followed a few tutorials on this and came up with the blueprint below, note I have set Monday to 0 and Sunday to 6, the function kicks out a Name or Int, the Int is all that is required for the next step.
-
Calc the ISO Week of Year - the criteria for ISO-8601 is basically the first week of the year contains a Thursday, and a week starts on a Monday. i.e. if Jan 1st is mon, tue, wed or thur then that is week 1. If fri, sat or sun, then week 2. Therefore if we plug in 1st of Jan for this year into above “GetDayOfWeek”, we find this out. We then calc the week of year and adjust accordingly to match the ISO standard.
I couldn’t find anyone else doing this in Unreal, but seems like it might be helpful. Always open to improvements / suggestions.
1 Like