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 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 # - microphone input does not work on android
- c # - change the travel time in dotween on the way
- c # - error moving object by dragging
- c # - sound playback in a place different from the place where the unity hit detection occurred
- c # - the error occurs only after building openfiledialog in unity
- c # - does the start function of a script that was turned off work when it is turned on again?
- c # - i want to output 10 random integers from 10 to 99 without duplication
- c # - it appears in the console window even though it is different from the condition of the unity if statement
- c # - i want to get 6fod information of oculus quest every frame and write it out as a record
- not enough middle parenthesis c #