Search


Ploticus > Scripts >
Dates




Ploticus date processing

Ploticus can plot dates directly and do date arithmetic. Many details of date processing, including localization of month and weekday names, can be controlled via settings in proc settings or in your config file.

There are also a number of functions that deal with dates.




Plottable date notations

The following date notations are supported for plotting and date arithmetic:

Month, day, and year notations:

    mmddyy (example: 033199)
    mm-dd-yy (example: 03-31-99)
    mm-dd-yyyy (example: 03-31-1999)
    mm/dd/yy (example: 03/31/99)
    dd-mm-yy (example: 31-03-99)
    dd/mm/yyyy (example: 31/03/99)
    ddmmmyyyy (example: 31mar1999 or 31MAR99)
    dd-mmm-yy (example: 31-mar-99 or 31-MAR-99)
    Others:
    mm/dd/yyyy  mmddyyyy      mm.dd.yy    mm.dd.yyyy
    mmm-dd-yy   mmm-dd-yyyy   mmm_dd_yy   mmm_dd_yyyy
    mmm/dd/yy   mmm/dd/yyyy
    
    dd-mm-yy    dd-mm-yyyy    dd/mm/yy    dd/mm/yyyy
    ddmmyy      dd.mm.yy      dd.mm.yyyy
    dd-mmm-yyyy dd_mmm_yy     dd_mmm_yyyy
    dd/mmm/yy   dd/mmm/yyyy   ddmmmyy     ddmmmyyyy
    
    yy-mm-dd    yy/mm/dd      yymmdd      yy.mm.dd
    yyyy-mm-dd  yyyy/mm/dd    yyyymmdd    yyyy.mm.dd
    yyyy-mmm-dd yyyy_mmm_dd   yyyymmmdd
    

Month & year notations
(a day value of 01 is used internally for arithmetic/plotting purposes):

    yymm (example: 9903)
    mm/yyyy (example: 03/1999)
    Others: yy/mm yy-mm yyyymm yyyy/mm yyyy-mm mm/yy mm-yy mm-yyyy

Quarter year notations
(day and month will be set to mid-quarter for arithmetic/plotting purposes):

    yyqn (example: 99q1 or 99Q1)
    nqyyyy (example: 1q1999 or 1Q1999)
    Others: yyyyqn nqyy

Year only notation

    yy (uses pivot year, so 00 is greater than 99)




Basic unit

The basic date unit is always a day, regardless of which notation is in use. Stub and tic increments may be expressed in months or years, if desired.




Setting date notation

Any date value to be plotted or involved in date arithmetic must conform to the current date notation. The default notation is mmddyy. In scripts, the date notation can be set using the xscaletype or yscaletype attributes of proc areadef , using proc settings or by using a config file. You can also set the date format at anytime using something like this in scripts:
    #call $setdateformat( mm/dd/yyyy )




Display-only notations

In addition to the above plottable notations, the following additional notations may be used only for displaying dates (such as with the stubformat attribute, for instance). They may not be used for date plotting or arithmetic.

Full dates for presentation:

    month_dd,_yyyy (or full) (example: March 31, 1999)
    mon_dd,_yyyy (example: Mar 31, 1999)
    dd_month,_yyyy (example: 31 March, 1999)
    dd_mon,_yyyy (example: 31 Mar, 1999)
    Www_dd_mon,_yyyy (or wfull) (example: Wed 31 Mar, 1999)

Month & year only: mmyy, mmyyyy

Month & day only: mmmdd, mmm/dd, mmm-dd, mmm_dd, mm/dd, mm-dd, mm_dd, dd-mmm, dd/mmm, ddmmm

Year only: 'yy, yyyy

Month only: mmm, mm, m

Day only: dd d

Weekday:

    W (example: S M T W T F S)
    Www (example: Sun Mon Tue Wed Thu Fri Sat)




Key to notation codes


m = single character month (use M for capitalized)
mm = numeric month 01-12
mmm = three-character month e.g. jan (use MMM for JAN or Mmm for Jan)
mon = month abbreviation e.g. Jan
month = full month e.g. January
dd = numeric day 01-31
d = numeric day 1-31
yy = numeric year 00-99
yyyy = numeric year 1800-up
w = single character weekday (use W for capitalized)
www = three character weekday (use Www or WWW for capitalized)
n = 1, 2, 3 or 4 (quarter year notations)
q = the letter q or Q (quarter year notations)
_ (underscore) = space




Notes

1. It is possible to omit weekends. This is usually done in business- or market-related plots. To omit weekends, set the omitweekends attribute in proc settings or your config file, or using the $setdateparms() function. Note: as of version 2.30 weekend omission is not supported (and gives incorrect results) for dates before julian 0 date (Jan 1 1970).

2. Date values may or may not be required to adhere exactly to the date format. For instance, if the format is mm/dd/yyyy a value such as 03/04/2001 is always legal, but a value such as 3/4/2001 may not be. Apparently spreadsheets often export dates such as the latter. See the strictdatelengths parameter in proc settings and/or your ploticus config file, or using the $setdateparms() function. By default, ploticus operates in lenient mode. Use strict mode to ensure that malformed dates will be detected.

3. Dates use an internal julian date system where 0 = January 1, 1970. Dates as far back as 1754 AD can be handled.

4. Conversion from two-digit dates to four digit dates is achieved using a pivot year- any two digit year less than this value is assumed to be 21st century. The default pivot year is 70. It can be set via proc settings or in your ploticus config file, or using the $setdateparms() function.

5. When three-character months are used, they are always entered and stored as lower case; however the capitalization of the "mmm" can be altered to control the way dates are presented, e.g. Mmm = Jan, MMM = JAN.

6. "Lazy" dates may be used. A lazy date has 00 as the day and/or month portion and is usually used in situations where the day and/or month is unknown or unavailable. When a lazy date is used in date arithmetic the missing month and/or day is converted to 01. By default, lazy dates are not permitted for date arithmetic.

7. When using notations that do not contain a specific day (such as month year, quarter year, or year only) there may be occasions when it is necessary to specify an exact day point (for example to create an annotation). To do this, an alternate full date format may be used. For example, if yyqn notation is being used, full dates may be given in yy/mm/dd format.

                            Alternate full-
    Notation                date notation
    -------------------     -----------
    yymm                    yymmdd
    yymmm                   ddmmmyy
    yy/mm, yy-mm, etc.      yy/mm/dd
    yyyy/mm, yyyy-mm, etc.  yyyy/mm/dd
    yy                      yymmdd
    mm/yy, mm-yy, etc.      dd/mm/yy
    mm/yyyy, mm-yyyy, etc.  dd/mm/yyyy
    yyqn                    yy/mm/dd
    yyyyqn                  yyyy/mm/dd
    nqyy                    yy/mm/dd
    nqyyyy                  yyyy/mm/dd
    


 


Ploticus 2.42 ... May 2013 Terms of use /