Date & Time
- Source
Methods
(inner) accessed()
Indicates the time and date when the document was last accessed by a Notes® client, whether for reading or editing.
- Source
No plans to implement
- Type
- Error
(inner) adjust(dateOrDateList, years, months, days, hours, minutes, seconds) → {TextOrTextList}
Adjusts the specified Date value by the number of years, months, days, hours, minutes, and/or seconds you specify. The amount of adjustment may be positive or negative.
Name | Type | Description |
---|---|---|
dateOrDateList | DateOrDateList | The Date or list of Dates you want to increment. This should be a single date, not a range. |
years | number | The number of years to increment by. |
months | number | The number of months to increment by. |
days | number | The number of days to increment by. |
hours | number | The number of hours to increment by. |
minutes | number | The number of minutes to increment by. |
seconds | number | The number of seconds to increment by. |
- Source
- See
- For further information, see www.hcltechsw.com
The adjusted date string or list of adjusted date strings.
- Type:
- TextOrTextList
rosettajs.DateTime.adjust(rosettajs.DateTime.date('6/30/95'), 2, 2, 2, 0, 0, 0); // returns '7/30/1995'
(inner) businessDays(startDate, endDate, daysToExcludeopt, datesToExcludeopt) → {NumberOrNumberList}
Returns the number of business days in one or more date ranges. Inclusive of the date ranges, and excluding provided optional weekends and holidays.
Name | Type | Attributes | Description |
---|---|---|---|
startDate | DateOrDateList | Date as string or Date type, or list of Dates. The start of each date range. | |
endDate | DateOrDateList | Date as string or Date type, or list of Dates. The end of each date range. | |
daysToExclude | NumberOrNumberList | <optional> | Numer or number list. Optional. Days of the week not counted as business days, where 1 is Sunday and 7 is Saturday. Decimal numbers are rounded to integers. Numbers other than 1-7 are ignored. (AKA Weekends) |
datesToExclude | string | | <optional> | Date as string or Date type, or list of Dates. Optional. Dates not counted as business days. (AKA Holidays) |
- Source
- See
- For further information, see www.hcltechsw.com
The number of days from startDates to endDates, inclusive, less daysToExclude and datesToExclude that fall within the date range.
- Type:
- NumberOrNumberList
rosettajs.DateTime.businessDays("01/01/2001", "12/31/2001", [1, 7], HOLIDAYS); // returns 251, where HOLIDAYS include a list of 10 major US holidays in 2001
(inner) created() → {Date}
Returns the Date when the document was created.
- Source
- See
- For further information, see hcltechsw.com
Date. The date when the current document was created.
- Type:
- Date
rosettajs.DateTime.created(); // returns Wed Aug 04 2021 12:23:17 GMT-0400 (Eastern Daylight Time) for the "Hot Chocolate" recipe document
(inner) date(yearOrDateTime, monthopt, dayopt, houropt, minuteopt, secondopt) → {string}
Constructs the date from year, month, and day of month or translates numbers for the various components of time and date, then returns the Date value.
Name | Type | Attributes | Description |
---|---|---|---|
yearOrDateTime | DateOrDateList | The year that you want to appear in the resulting date. You must specify an entire four-digit year. (For example, use 1996, not 96). Or Time-date or Date list. For a Date value such as @Now or [10/31/93 12:00:00], @Date removes the time portion of the value, leaving only the date. | |
month | number | <optional> | Optional (when DateTime provided). The month that you want to appear in the resulting date. (For example, use 1 to specify January). |
day | number | <optional> | Optional (when DateTime provided). The day that you want to appear in the resulting date. |
hour | number | <optional> | Optional. The number of hours. This value will be truncated from the resulting date. |
minute | number | <optional> | Optional. The number of minutes. This value will be truncated from the resulting date. |
second | number | <optional> | Optional. The number of seconds. This value will be truncated from the resulting date. |
- Source
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
A string representation of the date and time of the given year, month and day and www.oasis-open.org
- Type:
- string
rosettajs.DateTime.date(12, 12, 12); // returns Thu Dec 12 1912 00:00:00 GMT-0500 (Eastern Standard Time)
(inner) dateDif(start_date, end_date, unit) → {Number}
Calculates the number of days, months, or years between two dates.
Name | Type | Description |
---|---|---|
start_date | CustomDateType | A date that represents the first, or starting date of a given period. |
end_date | CustomDateType | A date that represents the last, or ending, date of the period. |
unit | string | The type of information that you want returned, where:
|
- Source
- See
- For further information, see docs.oasis-open.org
Days, months, or years between given dates.
- Type:
- Number
rosettajs.DateTime.dateDif("1/1/2001", "1/1/2003", "Y"); // returns 2
rosettajs.DateTime.dateDif("6/1/2001", "8/15/2002", "D"); // returns 440
(inner) dateValue(date_text) → {Date}
Returns the string representation of the date and time from given text.
Name | Type | Description |
---|---|---|
date_text | string | Text that represents a date in an OpenFormula date format, or a reference to a value that contains text that represents a date in an OpenFormula date format. |
- Source
- See
- For further information, see docs.oasis-open.org
A string representation of the date and time of the given date.
- Type:
- Date
rosettajs.DateTime.dateValue("1/1/1900"); // returns Mon Jan 01 1900 00:00:00 GMT-0500 (Eastern Standard Time)
(inner) day(dateOrDateList) → {NumberOrNumberList}
Extracts the day of the month from the specified date.
Name | Type | Description |
---|---|---|
dateOrDateList | DateOrDateList | The date, as a string, number, Date object, or Array of Date objects, containing the day value that you want to extract. |
- Source
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
Number or Number list. The number corresponding to the day of the month indicated by dateOrDateList. Returns -1 if the Date provided contains only a time value and not a date. and www.oasis-open.org
- Type:
- NumberOrNumberList
rosettajs.DateTime.day(2958465); // returns 31 (open formula only)
rosettajs.DateTime.day(new Date(1900, 0, 1)); // returns 1
(inner) days(endDate, startDate) → {number}
Returns the number of days between two dates.
Name | Type | Description |
---|---|---|
endDate | CustomDateType | A date that represents the last, or ending, date of the period |
startDate | CustomDateType | A date that represents the first, or starting date of a given period |
- Source
- See
- For further information, see docs.oasis-open.org
Number of days between two given dates.
- Type:
- number
rosettajs.DateTime.days("1/2/1900", "1/1/1900"); // returns 1
(inner) days360(endDate, startDate, methodopt) → {number}
Calculates the number of days between two dates based on a 360-day year.
Name | Type | Attributes | Description |
---|---|---|---|
endDate | CustomDateType | A date that represents the last, or ending, date of the period. | |
startDate | CustomDateType | A date that represents the first, or starting date of a given period. | |
method | string | <optional> | Optional. A logical value that specifies whether to use the U.S. or European method in the calculation. The default is FALSE.
|
- Source
- See
- For further information, see docs.oasis-open.org
Number of days between two given dates based on a 360-day year.
- Type:
- number
rosettajs.DateTime.days360("1/1/1901", "12/31/1901", true); // returns 359
(inner) eDate(startDate, months) → {Date}
Returns the date and time that is the indicated number of months before or after the start date.
Name | Type | Description |
---|---|---|
startDate | CustomDateType | A date that represents the first, or starting date of a given period. |
months | number | The number of months before or after start_date. A positive value for months yields a future date; a negative value yields a past date. |
- Source
- See
- For further information, see docs.oasis-open.org
The date of the given date and number of months.
- Type:
- Date
rosettajs.DateTime.eDate(rosettajs.DateTime.date(2011, 1, 23), 1); // returns Sun Feb 23 2011 00:00:00 GMT-0500 (Eastern Standard Time)
(inner) eoMonth(startDate, months) → {Date}
Returns the string representation of the date and time of the last day of the month before or after a specified number of months.
Name | Type | Description |
---|---|---|
startDate | CustomDateType | A date that represents the first, or starting date of a given period. |
months | number | Number of months before or after start_date. A positive value for months yields a future date; a negative value yields a past date. |
- Source
- See
- For further information, see docs.oasis-open.org
The date of the given date number of months.
- Type:
- Date
rosettajs.DateTime.eoMonth("1/1/2005", 2); // returns Thu Mar 31 2005 00:00:00 GMT-0500 (Eastern Standard Time)
(inner) getCurrentTimeZone() → {string}
Returns the current operating system's time zone settings in canonical time zone format.
- Source
- See
- For further information, see www.hcltechsw.com
Canonical time zone representing the time zone settings of the operating system. If the Notes time zone string is not found, the JavaScript time zone name is returned.
- Type:
- string
rosettajs.DateTime.getCurrentTimeZone(); // returns "Z=5$DO=1$DL=3 2 1 11 1 1$ZX=40$ZN=Eastern" if in the Eastern Time Zone
(inner) hour(dateOrDateList) → {NumberOrNumberList}
Extracts the number of the hour (0 through 23) from a specified Date.
Name | Type | Description |
---|---|---|
dateOrDateList | DateOrDateList | The date, as a string, Date object, or Array of Date objects, with the hour that you want to extract. |
- Source
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
Number or Number list. Hour portion (or list of hours) of the given date. and www.oasis-open.org
- Type:
- NumberOrNumberList
rosettajs.DateTime.hour("1/1/1900 1:00"); // returns 1
rosettajs.DateTime.hour(rosettajs.DateTime.date(95, 11, 20, 8, 58, 12)); // returns 8
(inner) interval(second) → {string}
Calculates the number of years, months, days, hours, minutes and seconds from a specified number of seconds.
Name | Type | Description |
---|---|---|
second | number | Number of seconds. |
- Source
A string representing the years, months, days, hours, minutes and seconds based on the given number of seconds.
- Type:
- string
rosettajs.DateTime.interval(10000000); // returns "P3M25DT17H46M40S"
(inner) isoWeekNum(date) → {number}
Returns the number of the ISO week number of the year for a given date.
Name | Type | Description |
---|---|---|
date | CustomDateType | The date. |
- Source
- See
- For further information, see docs.oasis-open.org
Number of the week in the year of given date.
- Type:
- number
rosettajs.DateTime.isoWeekNum("1/8/1901"); // returns 2
(inner) locale(action, localeTagopt) → {TextOrTextList}
Returns information about language codes.
Name | Type | Attributes | Description |
---|---|---|---|
action | TextOrTextList | Text or text list with action keyword. One of the following: [NotesLocale] without locale-tag returns a text list containing all the content language codes. [NotesLocale] with locale-tag returns a text list or value containing each specified content language code, or a null string if the code is not recognized. A code is recognized if it is exact regardless of case. If the language is recognized but not the country or region, the language code alone is returned. [AltNameLocale] without locale-tag returns a text list containing all the alternate name language codes. [AltNameLocale] with locale-tag returns a text list or value containing each specified alternate user language code, or a null string if the code is not recognized. A code is recognized if it is exact regardless of case. The country or region is ignored where it is not part of the alternate user language code (most cases). [LanguageName] with locale-tag returns a text list or value spelling out the language for each specified language code, or a null string if the code is not recognized. [CountryName] with locale-tag returns a text list or value spelling out the country or region for each specified language code, or a null string if the code has no country or region, or it is not recognized. [LocaleName] with locale-tag returns a text list or value spelling out the language and country (or region), if applicable, for each specified language code, or a null string if the code is not recognized. The country or region is in parentheses and immediately (no space) follows the language. [LocaleName] : [NotesLocale] (concatenating these two keywords) returns a text list containing, for each content language code, the language name, the country or region name in parentheses, a vertical bar, and the language code. This list can be used in a keyword field where the locale name is the name and the language code is the alias. [LocaleName] : [AltNameLocale] (concatenating these two keywords) returns a text list containing, for each alternate name language code, the language name, the country or region name in parentheses, a vertical bar, and the language tag. This list can be used in a keyword field where the locale name is the name and the language code is the alias. | |
localeTag | TextOrTextList | <optional> | A language code or list of language codes. af,ar,ar-AE,ar-BH,ar-DZ,ar-EG,ar-JO,ar-KW,ar-LB,ar-MA,ar-OM,ar-QA,ar-SA,ar-TN,ar-YE,be,bg,ca,cs,cy, da,de,de-AT,de-CH,de-DE,de-LI,de-LU,el,en,en-AU,en-CA,en-GB,en-HK,en-IE,en-IN,en-JM,en-NZ,en-PH,en-SG, en-US,en-ZA,es,es-AR,es-BO,es-CL,es-CO,es-CR,es-DO,es-EC,es-ES,es-GT,es-HN,es-MX,es-NI,es-PA,es-PE, es-PR,es-PY,es-SV,es-US,es-UY,es-VE,et,fi,fr,fr-BE,fr-CA,fr-CH,fr-FR,fr-LU,gu,he,hi,hr,hu,id,is,it,it-CH, it-IT,ja,kk,ko,lt,lv,mk,mr,ms,ms-MY,mt,nl,nl-BE,nl-NL,no,no-NO,ny-NO,pl,pt,pt-BR,pt-PT,ro,ro-MD,ro-RO, ru,sk,sl,sq,sr,sv,ta,te,th,tr,uk,vi,x-KOK,zh-CN,zh-HK,zh-MO,zh-SG,zh-TW |
- Source
- See
- For further information, see www.hcltechsw.com
Returns the requested information about the language codes. Empty string if tag is not found.
- Type:
- TextOrTextList
rosettajs.DateTime.locale([LanguageName]; "fr"); // returns "French"
rosettajs.DateTime.locale([LocaleName]; "fr-CA"); // returns "French(Canada)"
(inner) minute(dateOrDateList) → {NumberOrNumberList}
Extracts the number of the minutes from a specified Date.
Name | Type | Description |
---|---|---|
dateOrDateList | DateOrDateList | The date, as a string, Date object, or Array of Date objects, of the minuntes you are trying to find. |
- Source
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
Number or Number list. Minutes portion (or list of minutes) of the given date. and www.oasis-open.org
- Type:
- NumberOrNumberList
rosettajs.DateTime.minute("1/1/1900 1:30"); // returns 30
rosettajs.DateTime.minute(rosettajs.DateTime.date(95, 11, 20, 8, 58, 12)); // returns 58
(inner) modified() → {Date}
Returns the Date when the document was last modified.
- Source
- See
- For further information, see hcltechsw.com
Date. The date when the current document was last modified.
- Type:
- Date
rosettajs.DateTime.modified(); // returns Mon May 22 2023 12:46:49 GMT-0400 (Eastern Daylight Time) for the "Hot Chocolate" recipe document
(inner) month(dateOrDateList) → {NumberOrNumberList}
Extracts the number of the month (1-12) from the specified date.
Name | Type | Description |
---|---|---|
dateOrDateList | DateOrDateList | The date, as a string, Date object, or Array of Date objects of the month you are trying to find. |
- Source
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
Number or Number list. Month portion (or list of days) of the date (or list of dates). and www.oasis-open.org
- Type:
- NumberOrNumberList
rosettajs.DateTime.month(2958465); // returns 12 (open formula only)
rosettajs.DateTime.month(new Date(1900, 0, 31)); // returns 1
(inner) netWorkDays(startDate, endDate, holidaysopt) → {number}
Returns the number of whole workdays between two dates. Working days excludes weekends and any dates identified in holidays.
Name | Type | Attributes | Description |
---|---|---|---|
startDate | DateType | A date that represents the first, or starting date of a given period. | |
endDate | DateType | A date that represents the last, or ending, date of the period. | |
holidays | DateType | | <optional> | An optional range of one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays. |
- Source
- See
- For further information, see docs.oasis-open.org
The number of whole workdays between two dates.
- Type:
- number
rosettajs.DateTime.netWorkDays("2013-12-04", "2013-12-07"); // returns 3
rosettajs.DateTime.netWorkDays("12/4/2013", "1/4/2014", "1/1/2014"); // returns 22
(inner) netWorkDaysIntl(startDate, endDate, weekendopt, holidaysopt) → {number}
Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days.
Name | Type | Attributes | Description |
---|---|---|---|
startDate | CustomDateType | A date that represents the first, or starting date of a given period. | |
endDate | CustomDateType | A date that represents the last, or ending, date of the period. | |
weekend | string | <optional> | Indicates the days of the week that are weekend days and are not included in the number of whole working days between start_date and end_date. Weekend is a weekend number or string that specifies when weekends occur.
|
holidays | DateType | | <optional> | An optional range of one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays. |
- Source
The number of whole workdays between two dates.
- Type:
- number
rosettajs.DateTime.netWorkDaysIntl("12/4/2013", "12/5/2013"); // returns 2
rosettajs.DateTime.netWorkDaysIntl("12/8/2013", "12/9/2013", 2); // returns 0
(inner) now() → {Date}
Returns the string representation of the current date and time. The Notes parameters, flags and serverNames, are not implemented in VoltFormula at this time.
- Source
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
A date representation of the current date and time and www.oasis-open.org
- Type:
- Date
rosettajs.DateTime.now(); // returns Wed Jun 07 2023 12:26:36 GMT-0400 (Eastern Daylight Time)
(inner) second(dateOrDateList) → {NumberOrNumberList}
Extracts the number of the seconds from a specified Date. This function presumes that leap seconds never exist.
Name | Type | Description |
---|---|---|
dateOrDateList | DateOrDateList | The date, as a string, Date object, or Array of Date objects, of the seconds you are trying to find. |
- Source
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
Number or Number list. Seconds portion (or list of seconds) of the given date. and www.oasis-open.org
- Type:
- NumberOrNumberList
rosettajs.DateTime.second("1/1/1900"); // returns 0
rosettajs.DateTime.second("11/20/95 8:58:59"); // returns 59
rosettajs.DateTime.second(rosettajs.DateTime.date(95, 11, 20, 8, 58, 12)); // returns 12
(inner) textToTime(time_text) → {Date|DateRange|Array.<Date>|Array.<DateRange>}
Converts a text string to a Date value, where possible.
Name | Type | Description |
---|---|---|
time_text | TextOrTextList | The strings you want to convert to a Date objects. "Today", "Tomorrow", and "Yesterday" are the only legal strings to use to represent relative dates. |
- Source
- See
- For further information, see www.hcltechsw.com
Date, Date range, or list thereof. The time_text, converted to a Date.
- Type:
- Date |
DateRange | Array.<Date> | Array.<DateRange>
rosettajs.Text.textToTime("05/12/23"); // Returns Date for 05/12/2023
rosettajs.Text.textToTime("Tomorrow"); // Returns Date for tomorrow
(inner) time(…args) → {number}
Constructs and returns a Date object from one of the following combination of Date parameters: ( hour, minute, second ), ( year, month, day, hour, minute, second ), or Date object or array of Date objects, as per the notes formula Time function parameters.
Name | Type | Attributes | Description |
---|---|---|---|
args | * | <repeatable> | Date-time object or list of Dates, 6 Numbers representing the date-time, or 3 Numbers from 0 (zero) to 32767 representing the hour, minute, day. Any value greater than 23 will be divided by 24 and the remainder will be treated as the time value. |
- Source
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
A number representing time (as a fraction of a day) or Date-time object of the current time; display usually formatted in current locale. and www.oasis-open.org
- Type:
- number
rosettajs.DateTime.time(1, 1, 1); // returns 0.04237268518518519 (open formula only)
rosettajs.DateTime.time(93, 12, 24, 12, 30, 40); // returns 1993-12-24 12:30:40.000 -0000
rosettajs.DateTime.time(rosettajs.DateTime.date(93, 12, 24, 12, 30, 40)); // returns 1993-12-24 12:30:40.000 -0000
(inner) timeMerge(dateStr, timeStr, timeZoneopt) → {DateOrDateList}
Builds a Date value from separate date, time, and time zone values.
Name | Type | Attributes | Description |
---|---|---|---|
dateStr | DateOrDateList | String, Date, or array of Strings or Dates. The date string or Date object representing the date you want to include in the new date-time value. | |
timeStr | DateOrDateList | String, Date, or array of Strings or Dates. The time string or Date object representing the time you want to include in the new date-time value. | |
timeZone | string | <optional> | String. Optional. Default is 'Z' for UTC. The canonical time zone value you want to apply to the new date-time value. You can use a Time zone field to create this value. |
- Source
- See
- For further information, see www.hcltechsw.com
A new Date value or Date list made up of the date, time, and zone supplied as function parameters.
- Type:
- DateOrDateList
rosettajs.DateTime.timeMerge("02/23/02", "17:45:00"); // returns '02/23/02 17:45:00'
(inner) timeToTextInZone(timeDate, timeZone, format) → {TextOrTextList}
Converts a Date value to a text string, incorporating time zone information.
Name | Type | Description |
---|---|---|
timeDate | DateOrDateList | Time-date value or time-date list. The time-date value or values to be converted. |
timeZone | string | Canonical time zone value. You can derive a time zone value using a Notes® Time zone field. |
format | string | Optional. String consisting of one or more format specifiers. |
- Source
- See
- For further information, see www.hcltechsw.com
The time-date value converted to a string.
- Type:
- TextOrTextList
rosettajs.DateTime.Text.timeToTextInZone("02/26/2002 03:06 PM EST", "Z=9$DO=1$DL=4 1 1 10-1 1$ZX=3$ZN=Alaskan", "D2T1S3"); // Returns "02/26/2002"
(inner) timeValue(timeText) → {number}
Converts a time in the form of text to a serial number.
Name | Type | Description |
---|---|---|
timeText | string | The time represented by a text string. |
- Source
- See
- For further information, see docs.oasis-open.org
The decimal number of the time represented by a text string. The decimal number is a value ranging from 0 (zero) to 0.99988426, representing the times from 0:00:00 (12:00:00 AM) to 23:59:59 (11:59:59 P.M.).
- Type:
- number
rosettajs.DateTime.timeValue("1/1/1900 12:00:00"); // returns ~ 0.5
(inner) timeZoneToText(timezone, formatopt) → {TextOrTextList}
Converts a canonical time zone value to a human-readable text string.
Name | Type | Attributes | Description |
---|---|---|---|
timezone | TextOrTextList | Canonical time zone value or list thereof. Use a Notes® Time zone field to create a time zone value. | |
format | string | <optional> | String consisting of one or more of the following format specifiers:
|
- Source
- See
- For further information, see www.hcltechsw.com
The time-date value converted to a string. If you do not include a format specifier, a long time zone label is returned.
- Type:
- TextOrTextList
rosettajs.Text.timeZoneToText("Z=9$DO=1$DL=4 1 1 10 -1 1$ZX=25$ZN=America/Anchorage", "S"); // returns "GMT-8 AKDT" (when DST is in effect)
rosettajs.Text.timeZoneToText("Z=5$DO=1$DL=4 1 1 10 -1 1$ZX=25$ZN=America/New_York", "SA"); // returns "Local time" (when DST is in effect)
(inner) today() → {Date}
Returns today's date.
- Source
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
The date object for the current date and time. and www.oasis-open.org
- Type:
- Date
rosettajs.DateTime.today(); // returns Wed Jun 07 2023 12:26:36 GMT-0400 (Eastern Daylight Time)
(inner) tomorrow() → {Date}
Returns the time-date value that corresponds to tomorrow's date.
- Source
- See
- For further information, see www.hcltechsw.com
Date object. Tomorrow's date.
- Type:
- Date
rosettajs.DateTime.tomorrow(); // returns '6/7/2024' if today is June 6th, 2024
(inner) weekday(dateOrDateList, returnTypeopt) → {number}
Extracts the day of the week from a date; if text, uses current locale to convert to a date. Returns a number that identifies the day.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
dateOrDateList | DateOrDateList | The date | ||
returnType | number | <optional> | 1 | A number that determines the type of return value. The default is 1.
|
- Source
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
The day of the week of a given date as a number from 1 through 7. (default) and www.oasis-open.org
- Type:
- number
rosettajs.DateTime.weekday(2958465); // returns 6 (open formula only)
rosettajs.DateTime.weekday(rosettajs.DateTime.date(1900, 0, 31)); // returns 4
rosettajs.DateTime.weekday([rosettajs.DateTime.date(95, 11, 20, 8, 58, 12), rosettajs.DateTime.date(95, 11, 21, 8, 58, 12)]); // returns [2, 3]
(inner) weekNum(date, return_typeopt) → {number}
Converts a date to a number representing where the week falls numerically with a year.
There are two systems used for this function:
- System 1 The week containing January 1 is the first week of the year, and is numbered week 1.
- System 2 The week containing the first Thursday of the year is the first week of the year, and is numbered as week 1. This system is the methodology specified in ISO 8601, which is commonly known as the European week numbering system.
Name | Type | Attributes | Description |
---|---|---|---|
date | CustomDateType | A date within the week. | |
return_type | number | <optional> | Optional. A number that determines on which day the week begins. The default is 1.
|
- Source
- See
- For further information, see docs.oasis-open.org
The week number of given date.
- Type:
- number
rosettajs.DateTime.weekNum("2/1/1909", 2); // returns 6
(inner) workDay(startDate, days, holidaysopt) → {Date}
Returns the date before or after a specified number of workdays.
Name | Type | Attributes | Description |
---|---|---|---|
startDate | CustomDateType | A date that represents the first, or starting date of a given period. | |
days | number | The number of nonweekend and nonholiday days before or after start_date. A positive value for days yields a future date; a negative value yields a past date. | |
holidays | DateType | | <optional> | An optional range of one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays. |
- Source
- See
- For further information, see docs.oasis-open.org
The date before or after the specified number of workdays.
- Type:
- Date
rosettajs.DateTime.workDay("1/1/1900", 1); // returns 1/2/1900
rosettajs.DateTime.workDay("1/1/1900", 2, "1/2/1900"); // returns 1/4/1900
(inner) workDayIntl(startDate, days, weekendopt, holidaysopt) → {Date}
Returns the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days.
Name | Type | Attributes | Description |
---|---|---|---|
startDate | CustomDateType | A date that represents the first, or starting date of a given period | |
days | number | The number of nonweekend and nonholiday days before or after start_date. A positive value for days yields a future date; a negative value yields a past date. | |
weekend | string | | <optional> | Indicates the days of the week that are weekend days and are not considered working days. Weekend is a weekend number or string that specifies when weekends occur.
|
holidays | DateType | | <optional> | An optional set of one or more dates that are to be excluded from the working day calendar. Holidays shall be a range of cells that contain the dates, or an array constant of the serial values that represent those dates. The ordering of dates or serial values in holidays can be arbitrary. |
- Source
The date and time that was calculated before or after the given date.
- Type:
- Date
rosettajs.DateTime.workDay.intl("1/1/1905", 1, 2); // returns 1/3/1905
(inner) year(dateOrDateList) → {NumberOrNumberList}
Extracts the number of the month from the specified date.
Name | Type | Description |
---|---|---|
dateOrDateList | DateOrDateList | The date, as a string, Date object, or Array of Date objects of the year you are trying to find. |
- Source
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
Number or Number list. Year portion (or list of days) of the date (or list of dates). and www.oasis-open.org
- Type:
- NumberOrNumberList
rosettajs.DateTime.year(2958465); // returns 1995 (open formula only)
rosettajs.DateTime.year(new Date(1900, 0, 1)); // returns 1900
(inner) yearFrac(startDate, endDate, basisopt) → {number}
Returns the year fraction representing the number of whole days between start_date and end_date.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
startDate | CustomDateType | A date that represents the first, or starting date of a given period. | ||
endDate | CustomDateType | A date that represents the last, or ending, date of the period. | ||
basis | number | <optional> | 0 | The type of day count basis to use:
|
- Source
- See
- For further information, see docs.oasis-open.org
The year fraction of whole days between given dates.
- Type:
- number
rosettajs.DateTime.yearFrac("1/31/1900", "3/31/1900", 0); // returns ~ 0.16666666666666666
rosettajs.DateTime.yearFrac("1/1/1904", "1/1/1905", 1); // returns 1
(inner) yesterday() → {Date}
Returns the time-date value that corresponds to yesterday's date.
- Source
- See
- For further information, see www.hcltechsw.com
Date object. Yesterday's date.
- Type:
- Date
rosettajs.DateTime.yesterday(); // returns '6/5/2024' if today is June 6th, 2024
(inner) zone(dateOrDateList) → {NumberOrNumberList}
Returns the time zone setting of the current computer or of a time-date value, and indicates if daylight-saving time is observed. The time zone is represented as the number of hours that must be added to the time-date to convert it to Greenwich Mean Time.
Name | Type | Description |
---|---|---|
dateOrDateList | DateOrDateList | Date or date list. Optional. The date whose zone you want to know. You must specify both a date; otherwise, @Zone returns 0. |
- Source
- See
- For further information, see www.hcltechsw.com
Number or number list. The time zone, followed by a period, followed by a flag indicating daylight-saving time.
- Type:
- NumberOrNumberList
rosettajs.DateTime.zone([1/26/94 11:00 AM]); // returns 5 if in EST