In my application i get from a server some dates.
Some of the dates are in this format : "MMM dd, yyyy hh:mm:ss a" and some others in this : "yyyy-MM-dd HH:mm:ss Z" . I get the dates as strings from the server in one of the above formats. However i want all my dates to be in the first format. So how can i compare if the date is on the second format so i can change it? I know how to change formats , i just dont know how to compare a date with a specific format.
Thanks!
In my application i get from a server some dates. Some of the dates
Share
If you know the format that any given returned string is in then you could explicity set the format for each iteration of getting a date and then convert it to whatever format you need. Something like this example;