I need to get the current time and some other time and compare them. Both are possibly in different time zones, so my guess is that using
UniversalDateTime and converting to
LocalDateTime is the way to go here. I need to find out the difference between
otherDate in days.
I could not find an example for this.
This is the code so far:
// Get current date maxon::LocalDateTime currentDate(maxon::LocalDateTime::GetNow()); // Format string for date parsing const Char* dateFormatString = "%Y%m%d"; // Some other date String otherDateString = String("20200801"); // For testing, use August 1st 2020 const maxon::LocalDateTime otherDate = maxon::LocalDateTime::FromString(otherDateString, dateFormatString) iferr_ignore(); // How many days between the dates? maxon::UniversalDateTime difference = otherDate.ConvertToUniversalDateTime() - currentDate.ConvertToUniversalDateTime(); // Obviously, not correct
Thanks in advance & cheers,
EDIT: Originally, I had posted two questions. The solution to the first one came to me right after posting, so I removed the question.