DateTime.Now.ToString () is used to record the date on the Nifkura mobile backend, but on Unity, for some years like "2019/11/21 13:52:40" It comes first, but when run on Android, the moon comes first like "11/21/2019 13:54:13".Source code
float resultTime = Time.time-playTime; playRecord ["userId"] = PlayerPrefs.GetString ("UserID"); playRecord ["finishTime"] = DateTime.Now.ToString ();// The problem part is here playRecord ["playTime"] = resultTime; playRecord ["correct"] = correct; playRecord ["incorrect"] = incorrect; playRecord.SaveAsync ();
Is there no choice but to format it using DateTime.Now.Day etc. to unify it from each device?
I would like to know if there is a way to unify something.
Answer # 1
ToStringmethod is affected by the locale (regional information) by default, so specify the locale explicitly or specify the format.
// Specify locale DateTime.Now.ToString (new CultureInfo ("ja-JP"));// 2019/11/21 14:33:06 DateTime.Now.ToString (new CultureInfo ("en-US"));// 11/21/2019 14:33:06 // format specification DateTime.Now.ToString ("yyyyMMdd-HHmmss") // 20191121-143306
Answer # 2
Here is a detailed document on date and time formatting.
Standard date and time format string
Custom date and time format string
- c # - difference between cell array and character array in matlab
- c # - difference in description of contents of writeline (string)
- what is the difference between array segment and memory in c #?
- c # - what is the difference between readblockasync and readasync in streamreader?
- c # - what is the difference between delegate variables and delegate types?
- c # shape event handler
- c # - difference between basic design and detailed design
- c # - difference between unity gameobjectfind and public specification
- Talking about the difference between shape (,) and (, 1) of nparray in python
- c # - [unity] i was able to rotate horizontally and vertically during touch operations on the smartphone screen, but i want to m
- c # - how to binarize color images (reburning from xamarinandroid to swift)
- android - how to access binary files under unity's assets/resources with oculus quest
- c # - can i use 3 cameras?
- c # - i want sloths to move with the ferris wheel gondola (i want to add inertia)
- i want to color-code method names etc on visual studio 2017 c # text editor
- c # - it is difficult to write attribute one by one in unity, so i would like you to teach me an efficient method
- c # - the player character of unity rotates
- c # - when i click the button to execute hello world of vcontainer, the character string appears twice in the log, but i want to
- c # - i want to display at the previous scroll position when reopening in the scroll view of unity