Borrar filtros
Borrar filtros

how to convert data in UTC to a specific local time

133 visualizaciones (últimos 30 días)
Saeed Bello
Saeed Bello el 24 de Ag. de 2016
Comentada: Saeed Bello el 26 de Ag. de 2016
I have a one-year hourly data in UTC time. How do I convert the data to a specific local time say for example -5 UTC.

Respuesta aceptada

Peter Perkins
Peter Perkins el 25 de Ag. de 2016
UTC-5 is likely NOT your local time zone, since most locales shift for daylight saving. That's a detail many people forget.
You may be starting from timestamps in the form of text. If you use datetime, converting from UTC to local time is as easy as setting the TimeZone property, and datetime automatically accounts for daylight saving changes:
>> d = datetime({'25-Feb-2016 13:20:44' '25-Aug-2016 13:20:44'},'TimeZone','UTC')
d =
25-Feb-2016 13:20:44 25-Aug-2016 13:20:44
>> d.TimeZone = 'America/New_York'
d =
25-Feb-2016 08:20:44 25-Aug-2016 09:20:44

Más respuestas (0)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by