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));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.