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

# Powers of Ten History

Find when it was 10, 100, 1,000, 10,000, etc. days ago.

Run the code to find the current date:

This gives todays date:

 In[1]:= XToday
 Out[1]=

You can also get yesterdays date and tomorrows:

 In[2]:= XYesterday
 Out[2]=
 In[3]:= XTomorrow
 Out[3]=

 In[1]:= XToday
 Out[1]=

Find the date exactly 100 days ago. Try other numbers of days:

DatePlus adds a number of days to a date.

This gives the date 10 days from now:

 In[1]:= XDatePlus[Today, 10]
 Out[1]=

This gives the date 100 days ago:

 In[2]:= XDatePlus[Today, -100]
 Out[2]=

 In[1]:= XDatePlus[Today, -100]
 Out[1]=

Make a table of the first 9 powers of 10. Try different numbers of powers:

Were going to want to look at dates in powers of 10.

This is how to use Table to make a list of the first 9 powers of 10:

 In[1]:= XTable[10^n, {n, 9}]
 Out[1]=

 In[1]:= XTable[10^n, {n, 9}]
 Out[1]=

Make a table of powers of 10 dates. Try more than 5 dates:

This makes a list of dates in increasing powers of 10 days ago:

 In[1]:= XTable[DatePlus[Today, -10^n], {n, 5}]
 Out[1]=

Use DateString to format the date objects as text strings.

This gives today as a date object:

 In[2]:= XToday
 Out[2]=

This converts the date object to a text string:

 In[3]:= XDateString[Today, "Date"]
 Out[3]=

Make every element of the date list a text string:

 In[4]:= XTable[DateString[DatePlus[Today, -10^n], "Date"], {n, 5}]
 Out[4]=

Format the list as a column (you can use either the ...//Column form or the Column[...] form; they mean the same thing):

 In[5]:= XTable[DateString[DatePlus[Today, -10^n], "Date"], {n, 5}] // Column
 Out[5]=

 In[1]:= XTable[DateString[DatePlus[Today, -10^n], "Date"], {n, 5}] // Column
 Out[1]=

Include the number of days in a table. Try ranges other than 5:

Note: if you change the increment from 10, you have to change both occurrences of 10.

This makes a list of lists. Each sublist has a number of days, and the date that many days ago:

 In[1]:= XTable[{10^n, DateString[DatePlus[Today, -10^n], "Date"]}, {n, 5}]
 Out[1]=

Format the list of lists as a grid. Each sublist is a row in the grid:

 In[2]:= XGrid[Table[{10^n, DateString[DatePlus[Today, -10^n], "Date"]}, {n, 5}]]
 Out[2]=

Use FrameAll to add frame lines:

 In[3]:= XGrid[Table[{10^n, DateString[DatePlus[Today, -10^n], "Date"]}, {n, 5}], Frame -> All]
 Out[3]=

 In[1]:= XGrid[Table[{10^n, DateString[DatePlus[Today, -10^n], "Date"]}, {n, 5}], Frame -> All]
 Out[1]=

Share ItMake a website that gives powers of ten tables for dates:

Deploy a form that gives you a power of ten table for a date you specify:

 In[1]:= XCloudDeploy[FormFunction[{"date" -> "Date"}, Grid[Table[{10^n, DateString[DatePlus[#date, -10^n], "Date"]}, {n, 5}], Frame -> All] &, "PNG"], "Permissions" -> "Public" ]
 Out[1]=

Click the link in the output to visit the site.

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

 In[1]:= XCloudDeploy[FormFunction[{"date" -> "Date"}, Grid[Table[{10^n, DateString[DatePlus[#date, -10^n], "Date"]}, {n, 5}], Frame -> All] &, "PNG"], "Permissions" -> "Public" ]
 Out[1]=