Hey!
I'm probably missing something really obvious, but I'm trying to get the DateTime property into a String so I can use this for my "Autosave" function.
My current autosave function is like this:
SaveGameSlot(1, savelocation);
With savelocation being defined as something like this, to define the "chapter" of the game the player is playing and the location when the game was saved.
savelocation = "AUTO: Arrival - Inn bedroom";
But I'd like try something like
SaveGameSlot(1, "AUTO:" DateTime);
Obviously the above doesn't work, but I'm having trouble trying to define DateTime within a string I can use for the save name.
Does anybody have any ideas?
Many thanks!
Shaun
DateTime is a struct, you need to get an instance of one, and also retrieve some values, as it cannot format on its own.
Something like
DateTime *now = DateTime.Now;
String desc = String.Format("AUTO: %d / %d / %d / %d : %d : %d",
now.Year, now.Month, now.DayOfMonth, now.Hour, now.Minute, now.Second);
Display("TEST: %s", desc); // just for a test
SaveGameSlot(1, desc);
Thank you so much CW, you're the best!
It worked immediately.
(https://tinyimg.io/i/pjxUGXI.png)