# Read CSV, converting column containing String "Date" to a specific proper Date format

**URL:** <https://discourse.julialang.org/t/read-csv-converting-column-containing-string-date-to-a-specific-proper-date-format/57712>\
**Category:** New to Julia\
**Created:** [March 22, 2021, 1:29pm UTC](https://discourse.julialang.org/t/read-csv-converting-column-containing-string-date-to-a-specific-proper-date-format/57712 "2021-03-22T13:29:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nash/32/14482_2.png) [@Nash](https://discourse.julialang.org/u/Nash)\
**Post date:** [March 22, 2021, 1:29pm UTC](https://discourse.julialang.org/t/read-csv-converting-column-containing-string-date-to-a-specific-proper-date-format/57712/1 "2021-03-22T13:29:24Z")

</div>

Consider

data = CSV.read(“C:/Stocks/file.csv”)

One column of data holds information about dates in the format shown by, for example, “Feb 1, 2021”.

I wish to convert that entire column of data to the proper date-format m-d-yyyy.

How is that done “on the fly” (i.e., can it be done in the process of creating data)?

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [March 22, 2021, 1:54pm UTC](https://discourse.julialang.org/t/read-csv-converting-column-containing-string-date-to-a-specific-proper-date-format/57712/2 "2021-03-22T13:54:33Z")

</div>

Just pass `CSV.read` the dateformat you want to parse as dates:

```julia
julia> CSV.read(IOBuffer("""
           date, value
           "Feb 1, 2021", 12.50
           "Feb 2, 2021", 12.54
           "Feb 3, 2021", 12.76
           """), DataFrame, dateformat="u d, Y")
3×2 DataFrame
 Row │ date value
     │ Date Float64
─────┼─────────────────────
   1 │ 2021-02-01 12.5
   2 │ 2021-02-02 12.54
   3 │ 2021-02-03 12.76

```

Note that they’re now proper `Date` objects. They print out as YYYY-mm-dd by default, but you can of course [`format`](https://docs.julialang.org/en/v1/stdlib/Dates/#Dates.format-Tuple%7BTimeType,AbstractString%7D) them into a new string however you want.

(watch out, though, I think you have an old version of CSV.jl)
