The naturaldate( function converts a number representing a date into text using “natural” formatting.
Parameters
This function has two parameters:date – is the number you want to conver to text. This number is treated as the number of days since January 1, 4713 B.C.
pattern – is text that contains three patterns for formatting the date (see Date Patterns), separated by semicolons. The first pattern should specify just the day of the week, for example Day
or DayOfWeek
(or an alternate capitalization). The second pattern should specify the month and day, for example Mon dd
. The third pattern should specify the complete date, for example MM/DD/YY
. If this parameter is omitted, the function will default to the patterns:
Day;Mon dd;MM/DD/YY
Description
This function converts a number representing a date into text using “natural” formatting. The examples below assume today’s date is December 15, 2014.
naturaldate(today()) ☞ Today
naturaldate(today()+1) ☞ Tue
naturaldate(today()+10) ☞ Next Thu
naturaldate(today()+100) ☞ Mar 25
naturaldate(today()+200) ☞ 07/03/15
naturaldate(today()-1) ☞ Sun
naturaldate(today()-5) ☞ Last Wed
naturaldate(today()-50) ☞ Oct 26
naturaldate(today()-200) ☞ 05/29/14
You can customize the output by supplying your own patterns. In these examples, the output is all upper case.
naturaldate(today(),"DAY;MON DD;MM/DD/YY") ☞ TODAY
naturaldate(today()+1,"DAY;MON DD;MM/DD/YY") ☞ TUE
naturaldate(today()+10,"DAY;MON DD;MM/DD/YY") ☞ NEXT THU
naturaldate(today()+100,"DAY;MON DD;MM/DD/YY") ☞ MAR 25
naturaldate(today()+200,"DAY;MON DD;MM/DD/YY") ☞ 07/03/15
naturaldate(today()-1,"DAY;MON DD;MM/DD/YY") ☞ SUN
naturaldate(today()-5,"DAY;MON DD;MM/DD/YY") ☞ LAST WED
naturaldate(today()-50,"DAY;MON DD;MM/DD/YY") ☞ OCT 26
naturaldate(today()-200,"DAY;MON DD;MM/DD/YY") ☞ 05/29/14
Note: In Panorama 6 there was a separate function if you wanted to supply your own patterns – naturaldatepattern(. Now the naturaldate( function can also include a second parameter with patterns, so the naturaldatepattern( function is superfluous. However, it is still included for compatibility with older databases.
See Also
History
Version | Status | Notes |
10.0 | Updated | Carried over from Panorama 6.0, but now combines the naturaldate( and naturaldatepattern( functions into a single function. Also, the breakpoint for full dates is now +/- 120 days, instead of 180 days. This function is also much faster than it was in Panorama 6.0. |