I need to be able to get the current date, it doesn't really matter what format it is. Is there a function, or perhaps an API i can use?
How do I get the current date in GML?
1.2k Views Asked by Arild Gustad At
2
There are 2 best solutions below
0
On
You can get the current date a number of ways in GML. The easiest of which is probably using the variables current_second, current_minute, current_hour, current_day, current_weekday, current_month, current_year
Here's an example that draws the day, month, and year.
draw_text(32, 32, "Today is " + string(current_day) + "/" + string (current_month) + "/" + string(current_year) +".");
You can change the timezone using date_set_timezone(timezone); The available timezones are timezone_utc and timezone_local.
Another way to get the date is using date_current_datetime();
myhour = date_get_hour(date_current_datetime());
myday = date_get_day(date_current_datetime());
It exists some ways to do it. If you only need to show the current datetime you can use this:
This will return something like: "Today is 3/6/2017 - 23:40:15."