CALC 1 uses the JavaScript Date Object for most date calculation. Use the c1.yyyymmdd() and c1.jsdate() functions to convert between Date objects and YYYYMMDD format.
Function | Description | Example | Result |
---|---|---|---|
yyyymmdd(jsdate); | Returns a YYYYMMDD number for a Date Object. | c1.yyyymmdd(new Date(2017,9,1,2,3,4)); | 20171001.020304 |
jsdate(yyyymmdd) | Returns a Date Object for a YYYYMMDD number | c1.jsdate(20171001); | Oct 1, 2017 |
dateadd(date, days) | Adds days to the date (YYYMMDD) and returns a date, YYYYMMDD (ISO 8601). | c1.dateadd(20090101, 251); | 20090909 |
days(startdate, enddate) | The number of actual days between two dates. | c1.days(20090101, 20090909) | 251 |
days360(startdate, enddate, method) | The number of days between two dates, using the 360 day year. Method can be constants EURO (european = 1), or NASD (US, without spreadsheet bugs = 0). | c1.days360(20081220, 90331, c1.NASD); | 101 |
CALC 1 uses the ISO 8601 YYYYMMDD format for entering dates. This is a common date format that most users around the world are familiar with.
For example, April 28, 2004 is entered as 40428. June 4, 2018 is entered as 180604.
An entry of 0 will use the current date.
If you omit the first two years (the century) of YYYY, CALC 1 will use the current century, 20. This is a common truncated representation.
If you omit the entire YYYY, CALC 1 will use the current year.