Azzera filtri
Azzera filtri

how to convert UTC to IST(indian standard time)

13 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Star Strider
Star Strider il 6 Feb 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 Commenti
MONICA RAWAT
MONICA RAWAT il 14 Mar 2020
i tried using this but its showing as error that it is unable to convert
Star Strider
Star Strider il 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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Dates and Time in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by