Is there any user-friendly and efficient function to convert from a DateTime into a string? I'm thinking of something that would look like string(mydate, mydateformat)
, used for instance with mydate = Dates.now()
and mydateformat = Dates.DateFormat("yyyy-mm-dd H:M:S")
.
Thanks for asking this question; I realized I forgot to document the important Dates.format(dt::TimeType, df::DateFormat)
function!
The usage is pretty much what you're looking for:
julia> dt = DateTime(2015,7,15,3,2)
2015-07-15T03:02:00
julia> Dates.format(dt, "yyyy-mm-dd HH:MM:SS")
"2015-07-15 03:02:00"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With