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 answers
0
On
It exists some ways to do it. If you only need to show the current datetime you can use this:
show_message("Today is " + string(current_day) + "/" + string (current_month) + "/" + string(current_year) + " - " + string(current_hour) + ":" + string(current_minute) + "." + string(current_second) +".");
This will return something like: "Today is 3/6/2017 - 23:40:15."
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.
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();