- Home /
Get DateTime Android Bug ?
Hello,
I would like to create a daily reward, and for that I need the compare DateTime. On the Unity Editor, that's works PERFECTLY, but when I export my apps into Android the code stuck with the "Parse" method
I've created a Textbox to understand when the code stop to works : 'DebugText'
void Start()
{
DebugText.text = "Debug " + DateTime.Now.ToString("dd/MM/yyyy");
DateTime todaysDate = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy"));
DebugText.text = "Debug " + "TodayOK : ";
}
As result I have only "29/05/2020", and not "TodayOK" and all code after that are not played. I've tried with
DateTime todaysDate = Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy"));
But same result
Do you known if there is a specific way with Android to convert DateTime ? I really don't understand because on unity editor my entire code works perfectly :/
Thanks for your tips. Best Regards
Answer by danielos1996 · Feb 26, 2021 at 02:30 PM
Im having this issue as well was there ever a solution to this? Edit: Try doing it as month/day/year that solved my issue.
Or check the use of Timespan, allowing you to compare 2 DateTime
Your answer
Follow this Question
Related Questions
Convert datetime not working in android 0 Answers
Problem with GetNetworkTime 0 Answers
Timestamp and Date from Unity? for mobile 2 Answers
I want to call a function every twelve hours 2 Answers
Can't build directly to Android device 3 Answers