ENIGMA Forums
Outsourcing saves money => Programming Help => Topic started by: Rory on August 28, 2015, 04:39:41 pm
-
So in Enigma by default to date_date_string() function returns the date in the MM/DD/YYYY format. How can I change this to the DD/MM/YYYY format?
-
The date_date_string() should print locale dependent. So if you are outside US it should be DD/MM/YYYY.
But you can use date_datetime_stringf() to format it like you want. The formats can actually be found here: http://www.cplusplus.com/reference/ctime/strftime/, as the function is not currently documented in ENIGMA wiki.
So if you want DD/MM/YYYY it would be like this:
date_datetime_stringf(data, "%d/%m/%y");
-
Please follow Harri's advice, but also he is incorrect about these functions not being documented on the Wiki because they are (I documented every single one).
http://enigma-dev.org/docs/Wiki/Date_and_Time_Functions
On a side note Harri, I am not sure if that function is a great idea because what if we do ever support a different language, shouldn't we need to define our own date/time formatting? Don't stress about it, just something I want to call your attention to. At the same time it doesn't matter because we could likely just add the C++ standard date/time formatting to the other programming languages and adopt it as our standard.
-
Please follow Harri's advice, but also he is incorrect about these functions not being documented on the Wiki because they are (I documented every single one).
Except the one I posted. :D You documented GM functions and date_datetime_stringf() is not in GM.
On a side note Harri, I am not sure if that function is a great idea because what if we do ever support a different language, shouldn't we need to define our own date/time formatting? Don't stress about it, just something I want to call your attention to. At the same time it doesn't matter because we could likely just add the C++ standard date/time formatting to the other programming languages and adopt it as our standard.
What exactly do you propose? I don't know many ways to format time and this seems like a standard one. There is the .NET and Java version like "DD/MM/YYYY" which is actually a formatting string.
-
Yeah but still I documented it to.
And I'm not suggesting anything, just that we create our own now or stick with the C++ one. Like if we ever add JS as a scripting language like Unity that we wrap the method to format it the same way.
-
Yeah but still I documented it to.
I only see date_datetime_string, but no date_datetime_stringf. So I don't see how it is documented. :D
-
Ok that's weird, figured I would have documented that one, it's in fact, the only one I did not. I honestly have no idea anymore lol.