Once you know a date, there are lots of things you can compute. For example, MoonPhase gives the phase of the moon (or, more accurately, the fraction of the Moon that is illuminated when seen from the Earth).

Compute the phase of the moon now:

In[8]:=

Out[8]=

Compute the phase of the moon on a certain date:

In[9]:=

Out[9]=

Generate an icon for the phase of the moon:

In[10]:=

Out[10]=

If you know both the date and a location on Earth, you can work out when the sun will rise and set.

Compute when sunset will be today at my current location:

In[11]:=

Out[11]=

Compute the time between successive sunrises:

In[12]:=

Out[12]=

They’re about a minute off from being exactly 1 day (24 hours) apart:

In[13]:=

Out[13]=

Time zones are one of many subtleties. LocalTime gives the time in the time zone of a particular location.

Find the local time now in New York City:

In[14]:=

Out[14]=

Find the local time now in London:

In[15]:=

Out[15]=

Among the many areas where the Wolfram Language has extensive data is weather. The function AirTemperatureData uses this data to give the historical air temperature at a particular time and place.

Find the air temperature here at 6 pm yesterday:

In[16]:=

Out[16]=

If you provide a pair of dates, AirTemperatureData computes a time series of estimated temperatures between those dates.

Give a time series of air temperature measurements from a week ago until now:

In[17]:=

Out[17]=

DateListPlot is the analog of ListPlot for time series, where each value occurs at a particular date.

Plot the list of air temperature measurements:

In[18]:=

Out[18]=

The plot shows that, not surprisingly, the temperature is higher during the day than at night.

As another example, let’s look at data that goes much further back in time. WordFrequencyData tells one how frequently a particular word occurs, say in a sample of books published in a given year. There’s a lot of history one can see by looking at how this changes over the years and centuries.

Find the time series of how frequently the word “automobile” occurs:

In[19]:=

Out[19]=

Cars started to exist around 1900, but gradually stopped being called “automobiles”:

In[20]:=

Out[20]=

WordFrequencyData is set up to make it easy to compare frequencies of different words. Let’s see how “monarchy” and “democracy” have fared over the years. “Democracy” is definitely more popular now, but “monarchy” was more popular in the 1700s and 1800s.

As far as you want. The Wolfram Language knows about historical calendar systems, and the history of time zones. It also has the data to accurately compute sunrise, etc. going back at least 1000 years.

Why are sunrise and sunset given only to the minute?

Because you can’t compute more accurately than that exactly when the sun will actually rise and set without knowing things like air temperature that affect the bending of light in the Earth’s atmosphere.

Where does the Wolfram Language get air temperature data from?

The worldwide network of weather stations, located at airports and other places. If you’ve got your own air temperature measuring device, you can connect it to the Wolfram Language through the Wolfram Data Drop (see Section 43).

What is a time series?

It’s a way of specifying the values of something at a series of times. You can enter a time series in the Wolfram Language as TimeSeries[{{time1, value1}, {time2, value2}, ...}]. The Wolfram Language lets you do arithmetic and many other operations with time series.