ENIGMA Forums

Outsourcing saves money => Programming Help => Topic started by: Rory on August 28, 2015, 04:39:41 pm

Title: date_date_string change format
Post 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?
Title: Re: date_date_string change format
Post by: TheExDeus on August 28, 2015, 06:06:57 pm
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");
Title: Re: date_date_string change format
Post by: Goombert on September 01, 2015, 11:51:34 pm
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.
Title: Re: date_date_string change format
Post by: TheExDeus on September 02, 2015, 01:23:48 pm
Quote
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.

Quote
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.
Title: Re: date_date_string change format
Post by: Goombert on September 02, 2015, 03:25:36 pm
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.
Title: Re: date_date_string change format
Post by: TheExDeus on September 03, 2015, 06:14:51 am
Quote
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
Title: Re: date_date_string change format
Post by: Goombert on September 03, 2015, 08:19:08 am
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.