Questions about Mathematica's date and time functions.

learn more… | top users | synonyms (1)

23
votes
6answers
1k 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 ...
37
votes
1answer
829 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 ...
11
votes
3answers
521 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 dont'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 ...
5
votes
2answers
503 views

Finding the intersection of two date lists

I've got two lists that look like this ...
8
votes
3answers
302 views

Faster Alternatives to DateDifference

I need a faster implementation of FractionOfYear and FractionOfMonth, which do the following: Input: A time/date specified by ...
5
votes
2answers
377 views

From a list of dates get a list of the last date available in a each month

I wondered if anyone has another or even a more direct way of finding the last dates of each month available from a list of successive dates? I currently do the following (note: nothing special about ...
12
votes
1answer
224 views

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

Absolute time supposedly reports the "total number of seconds" between two dates, but it does not. For example because of the leap second applied at 2012-06-30T23:59:60Z ...
12
votes
2answers
353 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 ...
4
votes
1answer
348 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 ...
1
vote
1answer
307 views

Converting Excel serial dates with NETLink

Excel serial dates are not straightforward to convert since they include non-existent dates, e.g. {DatePlus[{1990, 1, 0}, 59], DatePlus[{1990, 1, 0}, 60]} ...
11
votes
5answers
885 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: ...
20
votes
3answers
1k 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.
6
votes
2answers
824 views

Measuring execution time of code

How one can measure the execution time (time that is spent for code to finish) of a program in Mathematica? I understand that there are general timing functions (Timing, AbsoluteTiming, TimeUsed, ...
17
votes
1answer
1k 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 ...
11
votes
2answers
950 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 ...
9
votes
1answer
188 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. ...
25
votes
0answers
589 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 ...
6
votes
5answers
321 views

Handling holidays in financial time series

I have two lists: list1and list2, which are financial time series with only 2 variables—date and price. The problem is: these ...
10
votes
1answer
186 views

Why do DateList, DateString, and AstronomicalData ignore $TimeZone?

My reading of the documentation for DateList and DateString lead me to believe that both functions use ...
10
votes
1answer
456 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 ...
9
votes
1answer
239 views

How do I determine astronomical transit times?

Mathematica, through the "legacy" Scientific Astronomer package, used to have the ability to easily determine accurate transit times of astronomical objects simply, with ...
7
votes
3answers
296 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? ...
5
votes
3answers
128 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.") ...
4
votes
1answer
484 views

Simple countdown timer in Mathematica

I dug around a bit and did not find a simple and clear implementation of countdown stopwatch in Mathematica. I am looking for a function that takes as an input a certain integer and then counts down ...
2
votes
1answer
90 views

Is it safe to change the value of $TimeZone?

I'd like to configure some of my notebooks to assume all calculations using dates, times and locations (notably AstronomicalData , but others too) take place at the ...
7
votes
3answers
161 views

Different results with DateRange and LeapYearsQ in Mathematica 9 and 10

With Mathematica 9.0 for Mac OS X x86 (64-bit) (January 24, 2013) one could use DateRange[{2000}, {2010}, "Year"] to achive ...
7
votes
3answers
397 views

Filter list based on date

What I would like to do is remove entries from a list of instrument data when it is in maintenance. The maintenance data I have is a series of dates which look like this; ...
2
votes
1answer
136 views

BarChart that lines up with dates in DateListPlot

I am trying to create a chart similar to the view offered by TradingChart, but with custom data not relating to finance. ...
2
votes
2answers
340 views

Histogram of runs

What I would like to do is generate a histogram of the consecutive time spent under a level. For example if the level I was interested in was 1.0 and I had this data; ...
1
vote
1answer
219 views

How can Time be made to go backwards?

I would like to make a countdown timer, but cannot find a reliable method to make the DateList[] function reverse. The not so robust code for the Digital Clock with the display of seconds follows: ...
0
votes
2answers
119 views

How to partition three years of data into daily samples

I'm trying to find mean of temperature data list. The temperature data list has 3 hours steps which means I have 365*8=2920 temperature measurements per year. My data are temperatures of 13 years. ...