Hi, I am designing a program to calculate the time different between two cities.
The operation is: subtracting second city time from the first one. I used the bellow code to get the cities time and convert it into 'string':
city1 = datestr(datetime('now','TimeZone','local',... 'Format','dd-MM-yyyy HH:mm:ss Z'));city1.TimeZone = 'America/New_York';city2 = datestr(datetime('now','TimeZone','local',... 'Format','dd-MM-yyyy HH:mm:ss Z'));city2.TimeZone = 'Africa/Khartoum';
The output will be in a formatted string as:
city1 = '25-Aug-2018 19:34:29' city2 = '25-Aug-2018 13:34:29'
The above is working properly but I can not subtract them in this form.
My question is: How to subtract the string forms above and get 4 cells output as "06:00" ?
Best Answer