lexx 1412 Posted November 4, 2017 Before I'll start making up some huge and complicated workaround... ... can anyone tell me if we have a simple way of turning the data aquired by "date" into something like this: Quote Tuesday, August 14th, 2035 The year is obvious, but do we have commands or macros to convert "8" into "August" and "14" into "14th" and the current day into "Tuesday" or do I have to make up my own crapcode for this? Share this post Link to post Share on other sites
HazJ 1289 Posted November 4, 2017 This maybe? https://community.bistudio.com/wiki/BIS_fnc_timeToString Edit: Never mind. I just saw your quote example. Edit 2: Maybe this? https://community.bistudio.com/wiki/BIS_fnc_fixDate Share this post Link to post Share on other sites
pierremgi 4943 Posted November 5, 2017 I didn't find a ready-made function. Anyway: // 2000 Jan 1st was Saturday _monthes = ["January","February","March","April","May","June","July","August","September","October","November","December"]; _days = [" 1st"," 2nd"," 3rd"]; for "_i" from 4 to 31 do {_days pushBack " "+str (_i)+"th"}; _daysOfWeek = ["Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"]; fn_date = { _date = _this; private _year = param [0]; private _nbrdays = 0; private _newDate = ""; for "_i" from 2000 to _year - 1 do { _nbrdays = _nbrdays + round linearConversion [0, 1, dateToNumber [_i, 12, 31, 23, 59], 0, 365, false]; }; _nbrdays = _nbrdays + linearConversion [0, 1, dateToNumber _date, 0, 365, false]; _dayofWeek = _daysOfWeek select (_nbrdays mod 7); _newDate = _dayofWeek + ", " + (_monthes select (_date select 1)-1) + (_days select (_date select 2)-1) + ", " + str _year; _newDate }; _yourdate = anydate call fn_date; // example: date call fn_date At least it works and you don't need extra script... 2 Share this post Link to post Share on other sites
Muzzleflash 111 Posted November 5, 2017 Your question prompted me to recreate strftime from C and Python in SQF. Almost all of the functionality is there, except the week numbers, timezone and microseconds. Your example would look like: private _text = [ [2035, 8, 14, 13, 37], "%A, %B %m%@O, %Y" ] call MF_fnc_DT_FormatTime; // Now _text is: "Tuesday, August 8th, 2035" To view the instructions and code click here , or click for the direct link to the file here. 1 Share this post Link to post Share on other sites
Grumpy Old Man 3550 Posted November 5, 2017 Also already in game: BIS_fnc_ordinalNumber Offers some more functionality. Cheers 1 1 Share this post Link to post Share on other sites
Muzzleflash 111 Posted November 5, 2017 4 minutes ago, Grumpy Old Man said: Also already in game: BIS_fnc_ordinalNumber Offers some more functionality. Good find. From looking at the arguments, which have gender, I am guessing that is language sensitive to what language the user is playing in. I will test it later, but if so, I am not going to use that until I am sure it will not be confusing. E.g. mixing german or french ordinals with implicit english. Share this post Link to post Share on other sites
Grumpy Old Man 3550 Posted November 5, 2017 Yeah, other than that using/writing your own library is always the best option, you know what you get and enhancing functionality is as easy as second nature. Cheers Share this post Link to post Share on other sites