Try now in the
Open Cloud »
(no sign-in required)

Age in Days, Hours, etc.

You know your age in years; how about in days?

Enter a date:

SHOW/HIDE DETAILS

DateObject gives you an exact date that you can do computations with:

In[1]:=
X
Out[1]=

It understands most common date formats:

In[2]:=
X
Out[2]=
In[3]:=
X
Out[3]=
In[4]:=
X
Out[4]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Run the code to compute the number of days from now back to a date. Try other dates:

SHOW/HIDE DETAILS

Now gives you the date and time at the instant you run it:

In[1]:=
X
Out[1]=

Subtract a date from Now to find the number of days back to the date:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Round to whole days. Try other dates:

SHOW/HIDE DETAILS

Round rounds decimal numbers to integers:

In[1]:=
X
Out[1]=

Round a date computation to get an answer in whole days:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Convert to minutes. Try other dates, like your birthday (to find out how many minutes old you are):

SHOW/HIDE DETAILS

UnitConvert converts between different units, like grams and pounds, or days and minutes.

This gives an answer in days:

In[1]:=
X
Out[1]=

Convert the result to minutes:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Spell out the result. Try other dates:

SHOW/HIDE DETAILS

The result of a date calculation has both a value (the number) and a unit (min):

In[1]:=
X
Out[1]=

Use QuantityMagnitude to get just the value:

In[2]:=
X
Out[2]=

IntegerName gives the spelled-out names of numbers:

In[3]:=
X
Out[3]=

Spell out the result of a date calculation:

In[4]:=
X
Out[4]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Get the result in seconds. Try other units, like Hours, Weeks, or Months:

In[1]:=
X
Out[1]=

Share ItMake a website that tells you how many days old you are. Try making a site that tells you how many seconds old you are:

SHOW/HIDE DETAILS

Deploy the days old calculation to make a website where you can enter a birthdate and find out how many days old you are:

In[1]:=
X
Out[1]=

Click the link in the output to visit the site.

Format the output more nicely using Row:

In[2]:=
X
Out[2]=

Make the text larger:

In[3]:=
X
Out[3]=

Share the link to the website by right-clicking the link in the output and choosing Copy Address. Paste the link into an email, tweet, or other message.

HIDE DETAILS
In[1]:=
X
Out[1]=