# Read datetime with timezone offset from csv

**URL:** https://discourse.julialang.org/t/read-datetime-with-timezone-offset-from-csv/102738
**Category:** General Usage
**Tags:** csv, timezones, datetime
**Created:** [August 11, 2023, 11:17pm UTC](https://discourse.julialang.org/t/read-datetime-with-timezone-offset-from-csv/102738 "2023-08-11T23:17:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vtomar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vtomar/32/18304_2.png) [@vtomar](https://discourse.julialang.org/u/vtomar)
#### Post date: [August 11, 2023, 11:17pm UTC](https://discourse.julialang.org/t/read-datetime-with-timezone-offset-from-csv/102738/1 "2023-08-11T23:17:48Z")

</div>

I have a csv file that contains datetime column where datetime contains timezone offset. for example:  
2019-01-11 17:35:00+00:00

How do I correctly specify the datetime format. I am currently specifying the format below but that only fetches 00:00 offset. How to make it generic?

> df = CSV.File(filename, dateformat = “yyyy-mm-dd HH:MM:SS+00:00”)

---

<div class="post-metadata">

### Author: ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)
#### Post date: [August 11, 2023, 11:46pm UTC](https://discourse.julialang.org/t/read-datetime-with-timezone-offset-from-csv/102738/2 "2023-08-11T23:46:13Z")

</div>

```julia
julia> using CSV, TimeZones

julia> b = IOBuffer("stamp,value\n2023-08-11 16:30:43.853-07:00,1\n2023-08-11 16:33:42.692-07:00,1\n")
IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=76, maxsize=Inf, ptr=1, mark=-1)

julia> CSV.File(b; dateformat="yyyy-mm-dd HH:MM:SS.sssz", types=Dict(:stamp=>ZonedDateTime))
2-element CSV.File:
 CSV.Row: (stamp = ZonedDateTime(2023, 8, 11, 16, 30, 43, 853, tz"UTC-07:00"), value = 1)
 CSV.Row: (stamp = ZonedDateTime(2023, 8, 11, 16, 33, 42, 692, tz"UTC-07:00"), value = 1)

```
