Mohammad Saad
Mohammad Saad

Reputation: 1995

Converting DateTime to string of series numbers in julia?

I would like to know how can I store the Date Time from Dates as a series of continuous numbers. For example:

using Dates
date=string(Dates.now())
println(date)

#Output --> 2021-06-15T19:39:17.171

I want it to be in the following format 20210615T193917171. May I know how can this be achieved in julia? Thanks!

Upvotes: 2

Views: 434

Answers (1)

Andrej Oskin
Andrej Oskin

Reputation: 2332

You should use Dates.format function

using Dates

dt = Dates.now()
Dates.format(dt, dateformat"yyyymmdd\THHMMSSsss")

UPD: fixed answer using suggestions in comments.

Upvotes: 2

Related Questions