I'm trying to get the date format of the device in my game. I changed my date format to month/day/year in the device's settings and the code down below gave me "MM/dd/yyyy" in the log. Then I changed my date format to day/month/year but still the log was "MM/dd/yyyy".
How can I get the date format in Android?
I'm using a class in the System.Globalization library
Debug.Log(DateTimeFormatInfo.CurrentInfo.ShortDatePattern)
I also tried to restart the device after changing the date format in the settings, but it didn't work.
DateTimeFormatInfo.CurrentInfo.ShortDatePattern are just format string.
Try
Debug.Log(System.DateTime.Now.ToString(DateTimeFormatInfo.CurrentInfo.ShortDatePattern));
Maybe try.
String DateString = system.datetime.now.tostring;
String[] BreakUp1 = DateString.split(',');
String[] BreakUp2 = BreakUp1.split('/');
String newDate = BreakUp[1] + "/" + BreakUp[0] + "/" + BreakUp[2];
This will create dd/mm/yyyy if the format is originally coming out mm/dd/yyyy.