Questions tagged [date-and-time]

Questions about Mathematica's date and time functions.

Filter by
Sorted by
Tagged with
58 votes
5 answers
8k views

Mathematica command that allows it to read my intentions

In version 2.0 of Mathematica there was a command, ReadProgrammerIntentions[ ] which allowed it rapidly compose code that could solve problems simple to complex, ...
51 votes
1 answer
3k views

How can I manipulate TemporalData?

Version 9 introduced TemporalData but, truth be told, the documentation doesn't suggest that one can do much with it. Many of us have probably assumed we'd be ...
Verbeia's user avatar
  • 34.2k
41 votes
4 answers
3k views

Does Mathematica have a built-in date picker?

Does Mathematica have an interactive date input control that lets the user choose a date by browsing to a calendar view and returning the selected date as a date list? For example, something like the ...
sakra's user avatar
  • 5,110
38 votes
2 answers
4k views

The Orbit and Perigee of the Flamsteed comet

Historical context This year we have the 330-th anniversary of the Battle of Vienna - one of the great formative events of European history, it took place on September 12, 1683. Kara Mustafa, Grand ...
Artes's user avatar
  • 57.2k
33 votes
1 answer
945 views

What calendar is Mathematica using for dates in the distant past?

It appears that Mathematica treats all dates as proleptic Gregorian dates by default, a hypothesis that can be easily tested by using AbsoluteTime to compute the ...
orome's user avatar
  • 12.8k
27 votes
6 answers
2k views

Faster alternatives for DayOfWeek

It has been noticed on several occasions that DayOfWeek function is rather slow when applied to a large list of dates, e.g. in this recent question. What faster ...
Leonid Shifrin's user avatar
27 votes
3 answers
6k views

how to make graphic timelines in mathematica

Hi does anyone know how to make timelines with mathematica? Something like that would be great!
user avatar
26 votes
1 answer
909 views

Mathematica cannot seem to properly handle times in the 1 hour before clocks go back

Using Chicago as an example; According to the current rules for applying daylight saving time, at 02:00:00 on the first Sunday of November, clocks in Chicago go back 1 hour (from Central Daylight Time ...
RobertNathaniel's user avatar
24 votes
3 answers
3k views

How can I make a heatmap of a days in year?

I know Mathematica has a ListPlot for time series but does it have a function for visualizing a list of dates as a heat map like this: This idea is from D3, check it out here.
M.R.'s user avatar
  • 31.4k
23 votes
11 answers
5k views

Determining the week of a year from a given date

Consider the following: AbsoluteTime["17/04/2012",{"Day","/","Month","Year"}]; From my calendar in my office, I know that April 17th is in the 16th week of the ...
John's user avatar
  • 4,361
22 votes
4 answers
2k views

Are Easter days normally distributed?

How can Mathematica be used to check if Easter days are normally distributed? By definition, Easter day is the first Sunday after the first full moon after the spring equinox (so between March 23d ...
anderstood's user avatar
  • 14.3k
21 votes
6 answers
1k views

Around the Clock

I want to produce with Mathematica something like this Or this 12 hours should be arranged in a pleasing ("rotated") style around / within a rectangle. I don't ask for the hands - depending on ...
eldo's user avatar
  • 61.9k
21 votes
4 answers
805 views

Reproducing the XKCD "Consensus New Year" plot

This xkcd strip for December 31, 2018 had the following plot: How may I use CountryData with DateListPlot (or other related ...
河上小太郎's user avatar
19 votes
1 answer
638 views

Is there a way to get AbsoluteTime to correctly report absolute time differences?

AbsoluteTime supposedly reports the "total number of seconds" between two dates, but it does not. For example, because of the leap second applied at 2012-...
orome's user avatar
  • 12.8k
17 votes
3 answers
480 views

How do you import "ISODateTime" and capture the time zone?

Bug introduced in V10.4 or earlier and persisting through 13.2.0 (CASE:3920785) Back in version 10.2 or so, Mathematica began supporting the ISO 8601 date/time format, which is nice because it's used ...
Pillsy's user avatar
  • 18.4k
17 votes
6 answers
964 views

Does Mathematica support importing ISO 8601 date strings?

Does Mathematica have a built-in function to convert ISO 8601 formatted date strings (e.g. 2012-01-04T00:00:00) to a date list? ISO 8601 strings come in a variety ...
sakra's user avatar
  • 5,110
15 votes
5 answers
3k views

Simpler way to fill date gaps with zero values

One basic problem when working with data like sales and dates is the case where you don't have sales in all days, so you have to fill it to take information as average or to make a plot. See this toy ...
Murta's user avatar
  • 26.2k
15 votes
3 answers
4k views

How do I compute sidereal time and JD?

There was once a package that provided a wide range of functions for computing astronomical information. This package now appears to be out of date; but as near as I can tell, many of the useful ...
orome's user avatar
  • 12.8k
14 votes
4 answers
385 views

How to evaluate the second argument of Cases only once

I'd like to find a fast but readable way to achieve the following: ...
mdeceglie's user avatar
  • 968
14 votes
3 answers
340 views

Min, Max are slow on TimeObjects

fixed in 10.1 (windows) There's something wrong with how Min and Max are implemented for ...
alancalvitti's user avatar
  • 15.1k
14 votes
5 answers
941 views

Calendar view outline

How to compute the outline of a calendar month like this D3 example. (D3 is a functional language built on JavaScript developed at Stanford and used by New York Times to deploy interactive graphics.)...
alancalvitti's user avatar
  • 15.1k
14 votes
2 answers
2k views

UNIX time to DateList

I have data that is timestamped with UNIX time, which is the number of seconds since January 1, 1970 UTC. Unfortunately, it seems that most of the date and time functions in Mathematica are based on ...
Sean Whalen's user avatar
14 votes
2 answers
569 views

ScheduledTask with scoped variables. Working with timed evaluation

I guess I have to try harder and focus more but timed evaluation always frustrates me. I will show the issue on simple example of delayed trigger. ...
Kuba's user avatar
  • 137k
13 votes
9 answers
2k views

How to split a number

I have a number representing date (yyyymmdd): 19001231 I want to convert this number to {1900,12,31} How to do this? There ...
cheese.burger's user avatar
13 votes
5 answers
4k views

Sort date list in format DD/MM/YYYY

I have a list of dates (ranging from 2007 to 2012) in the DD/MM/YYYY format and I need to sort this list. My problem is, when I simply use Sort[] I get: ...
Rod's user avatar
  • 3,318
13 votes
3 answers
1k views

How to count occurrences of Friday 13th

I would like to find a function that will count the number of times Friday 13th happens in a particular calendar year. Does anybody have any hints ? Thank you
user avatar
13 votes
2 answers
1k views

interpolating function over dates

I've got a bunch of readings at various dates and times. I'd like to be able to interpolate and then integrate over, say days. I can do this by converting my date/time to ...
Mitchell Kaplan's user avatar
13 votes
3 answers
570 views

Calculate moonrise

Mathematica has Sunrise[], but no Moonrise[]. But it has MoonPosition[], so I thought it ...
HJensen's user avatar
  • 537
13 votes
2 answers
483 views

How is AstronomicalData interpreting its date arguments?

It is easy to confirm that the AstronomicalData is not interpreting its arguments as UTC (or "GMT", which is, in any case, ambiguous) dates by verifying that the ...
orome's user avatar
  • 12.8k
13 votes
1 answer
278 views

DateInterval Min/Max performance issue

Bug introduced in 12.1 and persisting through 14.0.0 Update WRI has confirmed that this is a bug. CASE:4521676 The performance of Min and ...
Rohit Namjoshi's user avatar
12 votes
3 answers
1k views

Does Mathematica have Month Range and Day range?

It is known that CharacterRange["a", "z"] gives list of characters from a to z. Does Mathematica have something similar for weekdays and months of the year? ...
Basheer Algohi's user avatar
12 votes
1 answer
493 views

TimeConstrained dynamic change of maximum time

I would like to run a time consuming function: TimeConstrained[f[x],maxseconds] and be able to change maxseconds during running (increasing or decreasing max ...
tchronis's user avatar
  • 2,445
12 votes
1 answer
972 views

How can I get the frame ticks from DateListPlot?

DateListPlot very nicely chooses major and minor frame tick and frame tick label/markers. I am building a custom graphics function where either the ...
M.R.'s user avatar
  • 31.4k
12 votes
1 answer
676 views

Show timing of every output

I know I can follow Wolfram's guide and enable "ShowTiming" to show the timing of the previous command at the bottom of the window. Additionally, I can enable <...
Max Coplan's user avatar
11 votes
7 answers
368 views

DateList coupled with String Operations

Through some webscraping, I have the following list: ...
canadian_scholar's user avatar
11 votes
3 answers
2k views

MovingAverage[] and Fit[] with data containing DateLists

I have data which has the following appearance: data = {{DateList, Real}, ..., {DateList, Real}} It's easy to visualize the data by using ...
RMMA's user avatar
  • 2,680
11 votes
2 answers
269 views

Does Mathematica have a date region function together with operations like intersection?

Consider the following scenario. Suppose I consider time range from TimeObject[{18,30,0}] to TimeObject[{22,30,0}] on Weekdays ...
user13892's user avatar
  • 9,303
11 votes
2 answers
1k views

Plot time along the y-axis?

How can I plot times along the Y-axis, (with dates along the X-axis) e.g. ...
Soumya's user avatar
  • 213
11 votes
3 answers
2k views

Is it possible to import dates and times directly as AbsoluteTime and by pass DateLists?

Date and time calculations are quite slow so I am exploring ways to minimize the number of calculations performed. As an example: ...
Mike Honeychurch's user avatar
11 votes
1 answer
946 views

Wait / sleep miliseconds

Is there any way to make Mathematica stop for some miliseconds? I know about the Pause[] but it seems it only works with seconds.
José D.'s user avatar
  • 1,135
11 votes
1 answer
317 views

Incorrect behavior of TimeObject in version 13

I used to use TimeObject in my code and pass it the string coming from a database system as follows and it used to convert it to the correct time. ...
user13892's user avatar
  • 9,303
11 votes
1 answer
295 views

HistogramList for DateHistogram?

HistogramList and Histogram are closely related: ...
Kuba's user avatar
  • 137k
11 votes
1 answer
191 views

DatePlus and DayPlus perform much worse than my user-defined-function

I was debugging a function speed, and discovered that the time bottleneck was in DatePlus. I tried to change to DayPlus and get ...
Murta's user avatar
  • 26.2k
10 votes
3 answers
427 views

How to work with Date calculations?

I have never worked using the DateObject function But I suspect there must be a (easy) way of doing it. I want to find out, when in the future, from which point, ...
Chen Stats Yu's user avatar
10 votes
3 answers
838 views

Timeline plotting: horizontal bars of time intervals

This text file logs the time that a process (identified by a number) changes state ("Brown", "Blue" etc.") ...
user32916's user avatar
  • 101
10 votes
3 answers
625 views

Faster Alternatives to DateDifference

I need a faster implementation of FractionOfYear and FractionOfMonth, which do the following: Input: A time/date specified by <...
M.R.'s user avatar
  • 31.4k
10 votes
5 answers
1k views

Getting AbsoluteTiming to display in hours, minutes, and seconds

I'm doing some extended length calculations and was wondering how I could get AbsoluteTiming to display in hours, minutes, and seconds. I googled and found nothing, ...
Elem-Teach-w-Bach-n-Math-Ed's user avatar
10 votes
1 answer
209 views

DateDifference isn't consistent when giving result in years

This isn't really causing me a problem at the moment, but it's weird. Is this documented anywhere? When I ask for the difference in days and then in years between April 1, 2015 and October 1, 2015 ...
Mitchell Kaplan's user avatar
10 votes
2 answers
392 views

Approaches For Creating Cycle Plots in Mathematica

I am trying to create a cycle plot in Mathematica, and I am having a hard time finding the right approach to create the visualization. Can anyone give me a few pointers as to how to approach the ...
Nguyen Van Falk's user avatar
10 votes
1 answer
1k views

How to import date (YYYY-MM-DD) data from a file?

I have a file with data in form {date, value}: 2010-05-19 17 2010-05-20 20 ...
enedene's user avatar
  • 213

1
2 3 4 5
11