Reputation: 11
I want to change the format of the dates. I have column DATETIME in which the dates are arranged in YYYY-mm-dd format, I have to change the format to mm-dd-YYYY in julia. name of the dataframe df1, column nate DATETIME.
Upvotes: 1
Views: 242
Reputation: 10984
I assume that you want to go from a string to a string (since a Date
object in Julia doesn't have a specific format). You can (i) parse the string to a Date
object, then (ii) format as a string in your desired way:
julia> using Dates
julia> str = "2021-12-03";
julia> date = Date(str, dateformat"yyyy-mm-dd")
2021-12-03
julia> Dates.format(date, dateformat"mm-dd-yyyy")
"12-03-2021"
Upvotes: 3