# \#dates

**URL:** https://discourse.julialang.org/tag/dates/88.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [\[ANN\] TimeFloats.jl: Converting time to floats and vice versa](https://discourse.julialang.org/t/ann-timefloats-jl-converting-time-to-floats-and-vice-versa/136034)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 0\
**Last updated:** [March 5, 2026, 12:22pm UTC](https://discourse.julialang.org/t/ann-timefloats-jl-converting-time-to-floats-and-vice-versa/136034 "2026-03-05T12:22:08Z")

</div>

Hi all! TimeFloats.jl is a tiny utility package that converts between Julia’s Dates period types (Nanosecond, Second, Hour, Time, CompoundPeriod, etc.) and plain floating-point numbers, using any FixedPeriod as the unit…

---

## [How to Print/Parse a TimePeriod with a Specific Format?](https://discourse.julialang.org/t/how-to-print-parse-a-timeperiod-with-a-specific-format/78322)

<div class="topic-metadata">

**Author:** [@MLackner](https://discourse.julialang.org/u/MLackner)\
**Replies:** 9\
**Last updated:** [January 26, 2026, 3:41am UTC](https://discourse.julialang.org/t/how-to-print-parse-a-timeperiod-with-a-specific-format/78322 "2026-01-26T03:41:12Z")

</div>

Hi! I want to parse and print durations in the format "HH:MM:SS.sss". Parsing seems to be pretty simple. if I do for example julia\> str = "1:02:23.234" "1:02:23.234" julia\> t = Time(str) 01:02:23.234 this seems to wor…

---

## [Using dates as x axis in Makie.jl](https://discourse.julialang.org/t/using-dates-as-x-axis-in-makie-jl/133762)

<div class="topic-metadata">

**Author:** [@elwwan](https://discourse.julialang.org/u/elwwan)\
**Replies:** 3\
**Last updated:** [November 10, 2025, 9:40am UTC](https://discourse.julialang.org/t/using-dates-as-x-axis-in-makie-jl/133762 "2025-11-10T09:40:06Z")

</div>

Hello everyone, I am trying to plot brackets in Makie.jl while using dates as the x axis. Unfortunately it gives me an error since I can’t use Date() as an argument in bracket!(). Here is the code that causes the error…

---

## [Difference between dates, in years](https://discourse.julialang.org/t/difference-between-dates-in-years/130997)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 3\
**Last updated:** [July 24, 2025, 4:00pm UTC](https://discourse.julialang.org/t/difference-between-dates-in-years/130997 "2025-07-24T16:00:28Z")

</div>

The difference between Dates.Date returns a Day object. I want to get that number of days “in years”. I’ve been doing stuff like this d/Day(1)/365.25, but repeatedly typing number literals is so ripe for a typo, let alon…

---

## [Find decimal year from time](https://discourse.julialang.org/t/find-decimal-year-from-time/126670)

<div class="topic-metadata">

**Author:** [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Replies:** 7\
**Last updated:** [March 11, 2025, 9:15am UTC](https://discourse.julialang.org/t/find-decimal-year-from-time/126670 "2025-03-11T09:15:45Z")

</div>

Hi, I’ve searched for something in libraries like Dates and AstroTime, but maybe missed it as I’m surprised not to find it. I would like to find the decimal time from a date, hour, minute, second, e.g.: DateTime(2018,…

---

## [Dates: Strict parsing (DateFormat)](https://discourse.julialang.org/t/dates-strict-parsing-dateformat/130274)

<div class="topic-metadata">

**Author:** [@Parazetamol](https://discourse.julialang.org/u/Parazetamol)\
**Replies:** 1\
**Last updated:** [June 27, 2025, 10:55am UTC](https://discourse.julialang.org/t/dates-strict-parsing-dateformat/130274 "2025-06-27T10:55:54Z")

</div>

Hi there, is it possible to have the parsing of the specified DateFormat strict ? I don’t want to have a string like “1:2” parsed as Time when explicitly specifying dateformat"HH:MM:SS". Time("1:2",dateformat"HH:MM:SS…

---

## [Time range with reversed bounds](https://discourse.julialang.org/t/time-range-with-reversed-bounds/129693)

<div class="topic-metadata">

**Author:** [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Replies:** 5\
**Last updated:** [June 6, 2025, 4:51pm UTC](https://discourse.julialang.org/t/time-range-with-reversed-bounds/129693 "2025-06-06T16:51:12Z")

</div>

Hi, I have: using Dates lower\_bound = Dates.Time(23,59,00) upper\_bound = Dates.Time(00,01,00) I do: julia\> collect(upper\_bound:Dates.Minute(1):lower\_bound) 1439-element Vector{Time}: 00:01:00 00:02:00 00:03:00 ⋮ …

---

## [Determine date range given year and week number](https://discourse.julialang.org/t/determine-date-range-given-year-and-week-number/93878)

<div class="topic-metadata">

**Author:** [@isentropic](https://discourse.julialang.org/u/isentropic)\
**Replies:** 14\
**Last updated:** [March 30, 2025, 10:25pm UTC](https://discourse.julialang.org/t/determine-date-range-given-year-and-week-number/93878 "2025-03-30T22:25:50Z")

</div>

How can I get the date range (or just the Date of the Monday) of that week? For example, I have year = 2023 week=5, somehow I need to know that the Monday of that week is 2023-01-30. Using a relevant contructor from Da…

---

## [ISO8601 year week formatting](https://discourse.julialang.org/t/iso8601-year-week-formatting/127065)

<div class="topic-metadata">

**Author:** [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Replies:** 4\
**Last updated:** [March 26, 2025, 4:20am UTC](https://discourse.julialang.org/t/iso8601-year-week-formatting/127065 "2025-03-26T04:20:43Z")

</div>

Hello All This seems like it should be a very common situation, but I cannot seem to find a standard function in Dates to return the ISO 8601 Year and Week in Julia? The week number is correct, but It doesn’t seem to r…

---

## ["simple" Dates one line question](https://discourse.julialang.org/t/simple-dates-one-line-question/125465)

<div class="topic-metadata">

**Author:** [@Perrin\_Meyer](https://discourse.julialang.org/u/Perrin_Meyer)\
**Replies:** 6\
**Last updated:** [February 11, 2025, 4:06pm UTC](https://discourse.julialang.org/t/simple-dates-one-line-question/125465 "2025-02-11T16:06:24Z")

</div>

can a Dates guru help me with the one line function DateString(now()) that returns a string: Sat 01 Feb 2025 2:33pm I can’t figure out why Date(now()),DateFormat("yyyy-mm-dd")) is not valid… but I’m also being lazy… …

---

## [Comparing Javascript Temporal with Julia](https://discourse.julialang.org/t/comparing-javascript-temporal-with-julia/125419)

<div class="topic-metadata">

**Author:** [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Replies:** 0\
**Last updated:** [January 31, 2025, 7:37am UTC](https://discourse.julialang.org/t/comparing-javascript-temporal-with-julia/125419 "2025-01-31T07:37:22Z")

</div>

An article about Javascript’s upcoming Temporal API for working with dates and times is trending on Hacker News today. I was curious how it compared with Julia, so I used a small Pluto notebook to test things out and wri…

---

## [How to adjust the number and format of DateTime ticks using Plots.jl?](https://discourse.julialang.org/t/how-to-adjust-the-number-and-format-of-datetime-ticks-using-plots-jl/101980)

<div class="topic-metadata">

**Author:** [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Replies:** 2\
**Last updated:** [July 24, 2023, 12:07pm UTC](https://discourse.julialang.org/t/how-to-adjust-the-number-and-format-of-datetime-ticks-using-plots-jl/101980 "2023-07-24T12:07:33Z")

</div>

I am trying to plot a time series with Plots.jl. The x axis is in DateTime format, and I want to format the dates and limit the number of ticks. The following reproducible example serves to show what I am trying to acco…

---

## [Time period conversion to seconds, for plotting](https://discourse.julialang.org/t/time-period-conversion-to-seconds-for-plotting/123422)

<div class="topic-metadata">

**Author:** [@merlin](https://discourse.julialang.org/u/merlin)\
**Replies:** 2\
**Last updated:** [December 3, 2024, 5:07pm UTC](https://discourse.julialang.org/t/time-period-conversion-to-seconds-for-plotting/123422 "2024-12-03T17:07:07Z")

</div>

Meganecroposting here because of this problem I ran into while trying to format ticks on a logarithmic x-axis that represents time intervals. using Dates convert(Second, Week(100)) 60480000 seconds convert(Second, Mon…

---

## [How can I convert a CompoundPeriod type object to Period type in Julia?](https://discourse.julialang.org/t/how-can-i-convert-a-compoundperiod-type-object-to-period-type-in-julia/60930)

<div class="topic-metadata">

**Author:** [@shubh\_b](https://discourse.julialang.org/u/shubh_b)\
**Replies:** 19\
**Last updated:** [November 20, 2024, 1:08pm UTC](https://discourse.julialang.org/t/how-can-i-convert-a-compoundperiod-type-object-to-period-type-in-julia/60930 "2024-11-20T13:08:45Z")

</div>

Using Dates module in Julia I am able to transform a Period type object (Hour, Minute, Second, Day etc.) to another Period type as below: using Dates julia\> convert(Day, Hour(96)) 4 days julia\> convert(Second, Hour(20…

---

## [Retrieve current timezone](https://discourse.julialang.org/t/retrieve-current-timezone/122763)

<div class="topic-metadata">

**Author:** [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Replies:** 6\
**Last updated:** [November 18, 2024, 11:41am UTC](https://discourse.julialang.org/t/retrieve-current-timezone/122763 "2024-11-18T11:41:36Z")

</div>

I am missing two things in Dates/TimeZones convert a unix timestamp into the computer’s local time determine the system’s timezone Maybe I missed something? For 1) I have found a solution, which could go into Dates a…

---

## [How to format or print a difference in two DateTime objects](https://discourse.julialang.org/t/how-to-format-or-print-a-difference-in-two-datetime-objects/121638)

<div class="topic-metadata">

**Author:** [@anon91151494](https://discourse.julialang.org/u/anon91151494)\
**Replies:** 7\
**Last updated:** [October 23, 2024, 2:09pm UTC](https://discourse.julialang.org/t/how-to-format-or-print-a-difference-in-two-datetime-objects/121638 "2024-10-23T14:09:48Z")

</div>

I want to print the following object, which is a difference between two DateTimes datetime\_diff = datetime2 - datetime1 The type of datetime\_diff appears to be Milliseconds. That means it can be printed, but produces t…

---

## [Formating Dates.CompoundPeriod](https://discourse.julialang.org/t/formating-dates-compoundperiod/59167)

<div class="topic-metadata">

**Author:** [@Laco\_Kovac](https://discourse.julialang.org/u/Laco_Kovac)\
**Replies:** 6\
**Last updated:** [October 23, 2024, 11:54am UTC](https://discourse.julialang.org/t/formating-dates-compoundperiod/59167 "2024-10-23T11:54:54Z")

</div>

I have variable of type Dates.CompoundPeriod I need to change it to String in format HH:MM:SS (value will never exceed 1 hour) julia\> x = Dates.CompoundPeriod(Dates.Hour(12), Dates.Minute(13)) 12 hours, 13 minutes jul…

---

## [Dates.jl - week last week of year/first week of year](https://discourse.julialang.org/t/dates-jl-week-last-week-of-year-first-week-of-year/119703)

<div class="topic-metadata">

**Author:** [@Longblackcoffee](https://discourse.julialang.org/u/Longblackcoffee)\
**Replies:** 5\
**Last updated:** [September 22, 2024, 9:19pm UTC](https://discourse.julialang.org/t/dates-jl-week-last-week-of-year-first-week-of-year/119703 "2024-09-22T21:19:58Z")

</div>

Hi everyone, I have daily level data spanning multiple years, and I want to aggregate it to the weekly level. week(DateTime(2020, 12, 31)) week(DateTime(2021, 01, 01)) I noticed that the week function considers both t…

---

## [No method matching length(::DateTime)](https://discourse.julialang.org/t/no-method-matching-length-datetime/118262)

<div class="topic-metadata">

**Author:** [@johnbb](https://discourse.julialang.org/u/johnbb)\
**Replies:** 4\
**Last updated:** [August 16, 2024, 11:50am UTC](https://discourse.julialang.org/t/no-method-matching-length-datetime/118262 "2024-08-16T11:50:06Z")

</div>

I encountered this error message while using indexin in a for loop. Here is an example using Dates indexin(DateTime(2024,1), DateTime(2024,1):Day(1):DateTime(2024,2)) ERROR: MethodError: no method matching length(::Dat…

---

## [NanoDates.jl has reached version 1](https://discourse.julialang.org/t/nanodates-jl-has-reached-version-1/118130)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 0\
**Last updated:** [August 13, 2024, 11:18am UTC](https://discourse.julialang.org/t/nanodates-jl-has-reached-version-1/118130 "2024-08-13T11:18:40Z")

</div>

All NanoDates.jl posted issues have been resolved, all known bugs have been quashed, and I feel good about its state.

---

## [Date to float](https://discourse.julialang.org/t/date-to-float/20094)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 8\
**Last updated:** [July 22, 2024, 4:23pm UTC](https://discourse.julialang.org/t/date-to-float/20094 "2024-07-22T16:23:34Z")

</div>

Is there an easy way to convert date/datetime to a float representing year? I.e. f(2000-01-01) = 2000, f(2015-07-01) ~ 2015.5 and so on. The most obvious method is 2000 + (x - DateTime(2000, 1, 1)) / (DateTime(2001, 1, 1…

---

## [Putting Date objects on xticks using Plots.jl](https://discourse.julialang.org/t/putting-date-objects-on-xticks-using-plots-jl/116171)

<div class="topic-metadata">

**Author:** [@aziz\_ben](https://discourse.julialang.org/u/aziz_ben)\
**Replies:** 2\
**Last updated:** [June 25, 2024, 11:42am UTC](https://discourse.julialang.org/t/putting-date-objects-on-xticks-using-plots-jl/116171 "2024-06-25T11:42:00Z")

</div>

Hi, I tried to make a plot using Plots with dates under the ticks of the x axis but I ran into a problem. The dates are displayed in the plot in this format: yyyy/mm/ddT00:00:00. Does anyone know how to get rid of this?…

---

## [Discussion about DateTime from POSIX timestamp. Was (incorrect assumption): Dates in Windows - error in datetime from posix](https://discourse.julialang.org/t/discussion-about-datetime-from-posix-timestamp-was-incorrect-assumption-dates-in-windows-error-in-datetime-from-posix/111691)

<div class="topic-metadata">

**Author:** [@kodintent](https://discourse.julialang.org/u/kodintent)\
**Replies:** 9\
**Last updated:** [March 16, 2024, 5:21pm UTC](https://discourse.julialang.org/t/discussion-about-datetime-from-posix-timestamp-was-incorrect-assumption-dates-in-windows-error-in-datetime-from-posix/111691 "2024-03-16T17:21:51Z")

</div>

Hi. I didnt copy old known-working code, i did something else. here is how to get the correct value, provided by an answer below. datetime\_utc\_from\_posix = unix2datetime(posix\_int) \[ below is NOT how to get the corre…

---

## [How to filter Date data column in a DataFrame](https://discourse.julialang.org/t/how-to-filter-date-data-column-in-a-dataframe/110485)

<div class="topic-metadata">

**Author:** [@PeX](https://discourse.julialang.org/u/PeX)\
**Replies:** 3\
**Last updated:** [February 20, 2024, 11:58pm UTC](https://discourse.julialang.org/t/how-to-filter-date-data-column-in-a-dataframe/110485 "2024-02-20T23:58:30Z")

</div>

Hi everyone, I have a DataFrame with Dates type in one column named “Date” (the rest of the columns are with regular data). I want to filter the dataframe to have data only between years 2015 and 2019. I tried: df\[@. …

---

## [Using unix datetime as String](https://discourse.julialang.org/t/using-unix-datetime-as-string/59994)

<div class="topic-metadata">

**Author:** [@rikh](https://discourse.julialang.org/u/rikh)\
**Replies:** 5\
**Last updated:** [April 25, 2021, 5:42pm UTC](https://discourse.julialang.org/t/using-unix-datetime-as-string/59994 "2021-04-25T17:42:07Z")

</div>

I’m trying to pass a unix datetime to a server but am unsure how to avoid the scientific notation: julia\> using Dates julia\> t = datetime2unix(now()) 1.619369013568e9 julia\> "$t" "1.619369013568e9" Instead, the serve…

---

## [Plots with formatted DateTime xticks?](https://discourse.julialang.org/t/plots-with-formatted-datetime-xticks/48649)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 3\
**Last updated:** [January 16, 2024, 7:05am UTC](https://discourse.julialang.org/t/plots-with-formatted-datetime-xticks/48649 "2024-01-16T07:05:09Z")

</div>

I need to plot some data with DateTime type along the abscissa, and would like to have a nice formatting of the xtick argument. Consider this example: using Plots, Dates # function timeperiod(x::Float64) Second(Int…

---

## [End of Month for Date](https://discourse.julialang.org/t/end-of-month-for-date/107462)

<div class="topic-metadata">

**Author:** [@gsinha](https://discourse.julialang.org/u/gsinha)\
**Replies:** 2\
**Last updated:** [December 11, 2023, 7:21pm UTC](https://discourse.julialang.org/t/end-of-month-for-date/107462 "2023-12-11T19:21:39Z")

</div>

Why does this not work for rolling the date to 2023-06-30? ceil(Date("2023-06-01"), Month) - Day(1) The following works for every other date in that month, e.g ceil(Date("2023-06-02"), Month) - Day(1)

---

## [How to round up DateTime to the next whole Hour?](https://discourse.julialang.org/t/how-to-round-up-datetime-to-the-next-whole-hour/107135)

<div class="topic-metadata">

**Author:** [@atBNE](https://discourse.julialang.org/u/atBNE)\
**Replies:** 2\
**Last updated:** [December 4, 2023, 11:34pm UTC](https://discourse.julialang.org/t/how-to-round-up-datetime-to-the-next-whole-hour/107135 "2023-12-04T23:34:28Z")

</div>

How to round up DateTime to the next whole Hour? The Dates docs is heavy, and a beginner can get lost in it. using Dates function gvt(p1) dly = Hour(2) # a constant delay of 2 hours tym = now() # H…

---

## [Handling Dates](https://discourse.julialang.org/t/handling-dates/106879)

<div class="topic-metadata">

**Author:** [@Sourish](https://discourse.julialang.org/u/Sourish)\
**Replies:** 4\
**Last updated:** [November 29, 2023, 8:44am UTC](https://discourse.julialang.org/t/handling-dates/106879 "2023-11-29T08:44:10Z")

</div>

Hi I am trying to convert a string to date with the following code - but giving me some parsing error using Dates df = DateFormat("d-b-y"); dt = Date("28-Feb-99",df) I am getting the following error: ArgumentError: U…

---

## [Plots.jl plotly heatmap labels](https://discourse.julialang.org/t/plots-jl-plotly-heatmap-labels/106252)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 2\
**Last updated:** [November 17, 2023, 8:58am UTC](https://discourse.julialang.org/t/plots-jl-plotly-heatmap-labels/106252 "2023-11-17T08:58:23Z")

</div>

I’d like to create a large heatmap using Plots.jl and plotly. which should look like this, where all y axis labels are shown, these align with the tool tip, and if I zoom in I get an increased granularity of the x axis d…

[Next page](https://discourse.julialang.org/tag/dates/88.md?match_all_tags=true&page=1&tags%5B%5D=dates)
