Pages: 1
  Print  
Author Topic: date_date_string change format  (Read 1606 times)
Offline (Unknown gender) Rory
Posted on: August 28, 2015, 04:39:41 PM
Member
Joined: Sep 2014
Posts: 1

View Profile
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?
Logged
Offline (Unknown gender) TheExDeus
Reply #1 Posted on: August 28, 2015, 06:06:57 PM

Developer
Joined: Apr 2008
Posts: 1886

View Profile
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");
Logged
Offline (Male) Goombert
Reply #2 Posted on: September 01, 2015, 11:51:34 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3151

View Profile
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.
« Last Edit: September 01, 2015, 11:53:47 PM by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #3 Posted on: September 02, 2015, 01:23:48 PM

Developer
Joined: Apr 2008
Posts: 1886

View Profile
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.
Logged
Offline (Male) Goombert
Reply #4 Posted on: September 02, 2015, 03:25:36 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3151

View Profile
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.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #5 Posted on: September 03, 2015, 06:14:51 AM

Developer
Joined: Apr 2008
Posts: 1886

View Profile
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
Logged
Offline (Male) Goombert
Reply #6 Posted on: September 03, 2015, 08:19:08 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3151

View Profile
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.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Pages: 1
  Print