Effacer les filtres
Effacer les filtres

how to convert UTC to IST(indian standard time)

13 vues (au cours des 30 derniers jours)
MONICA RAWAT
MONICA RAWAT le 6 Fév 2020
Commenté : Star Strider le 14 Mar 2020
suppose i have a column of UTC given below i want to convert into IST so i want to add +5:30 hrs to my UTC column,so how could i convert.
08:29:54
08:30:55
08:31:56
08:32:57
08:33:58
08:34:59
09:00:00
09:01:01

Réponse acceptée

Star Strider
Star Strider le 6 Fév 2020
If you have R2014b or later, datetime will do this easily.
Try this:
TUCT = {'08:29:54'
'08:30:55'
'08:31:56'
'08:32:57'
'08:33:58'
'08:34:59'
'09:00:00'
'09:01:01'};
T = datetime(TUCT, 'InputFormat','HH:mm:ss', 'TimeZone','UCT')
T.TimeZone = 'Asia/Kolkata'
producing:
T =
8×1 datetime array
06-Feb-2020 08:29:54
06-Feb-2020 08:30:55
06-Feb-2020 08:31:56
06-Feb-2020 08:32:57
06-Feb-2020 08:33:58
06-Feb-2020 08:34:59
06-Feb-2020 09:00:00
06-Feb-2020 09:01:01
T =
8×1 datetime array
06-Feb-2020 13:59:54
06-Feb-2020 14:00:55
06-Feb-2020 14:01:56
06-Feb-2020 14:02:57
06-Feb-2020 14:03:58
06-Feb-2020 14:04:59
06-Feb-2020 14:30:00
06-Feb-2020 14:31:01
  11 commentaires
MONICA RAWAT
MONICA RAWAT le 14 Mar 2020
i tried using this but its showing as error that it is unable to convert
Star Strider
Star Strider le 14 Mar 2020
As Walter Roberson mentioned:
TUCT = "08:29:54.0127";
T = datetime(TUCT, 'InputFormat','HH:mm:ss.SSSS', 'TimeZone','UCT', 'Format','HH:mm:ss.SSSS')
T.TimeZone = 'Asia/Kolkata'
produces:
T =
datetime
13:59:54.0127

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by