rex_momentjs
Usage
Set date
Set date by one of these actions
Set date by one of these actions
- Action:Current date - Set date to current date. (Sample capx)
- Action:Unix timestamp - Set date from unix timestamp. (Sample capx)
- Action:Date string - Set date from string.
- Action:Clone - Clone date from another moment object.
- Action:Set component - Set date component of current date value.
Format of date string
ISO 8601 format
"Action:Date string" will check string with ISO 8601 formats if the parameter "Format" is "". An ISO 8601 string requires a date part.
"Action:Date string" will check string with ISO 8601 formats if the parameter "Format" is "". An ISO 8601 string requires a date part.
- 2013-02-08 # A calendar date part
- 2013-W06-5 # A week date part
- 2013-039 # An ordinal date part
- 20130208 # Basic (short) full date
- 2013W065 # Basic (short) week, weekday
- 2013W06 # Basic (short) week only
- 2013050 # Basic (short) ordinal date
- 2013-02-08T09 # An hour time part separated by a T
- 2013-02-08 09 # An hour time part separated by a space
- 2013-02-08 09:30 # An hour and minute time part
- 2013-02-08 09:30:26 # An hour, minute, and second time part
- 2013-02-08 09:30:26.123 # An hour, minute, second, and millisecond time part
- 2013-02-08 24:00:00.000 # hour 24, minute, second, millisecond equal 0 means next day at midnight
- 20130208T080910,123 # Short date and time up to ms, separated by comma
- 20130208T080910.123 # Short date and time up to ms
- 20130208T080910 # Short date and time up to seconds
- 20130208T0809 # Short date and time up to minutes
- 20130208T08 # Short date and time, hours only
- 2013-02-08 09 # A calendar date part and hour time part
- 2013-W06-5 09 # A week date part and hour time part
- 2013-039 09 # An ordinal date part and hour time part
- 2013-02-08 09+07:00 # +-HH:mm
- 2013-02-08 09-0100 # +-HHmm
- 2013-02-08 09Z # Z
- 2013-02-08 09:30:26.123+07:00 # +-HH:mm
- 2013-02-08 09:30:26.123+07 # +-HH
Custom format
Format is composed by these components, and ignores non-alphanumeric characters.
Year, month, and day tokens
Format is composed by these components, and ignores non-alphanumeric characters.
Year, month, and day tokens
- YYYY : 4 or 2 digit year (2014)
- YY : 2 digit year (14)
- Y : Year with any number of digits and sign (-25)
- Q :Quarter of year. Sets month to first month in quarter. (1..4)
- M MM : Month number (1..12)
- MMM MMMM : Month name in locale (Jan..December)
- D DD : Day of month (1..31)
- Do : Day of month with ordinal (1st..31st)
- DDD DDDD : Day of year (1..365)
- X : Unix timestamp (1410715640.579)
- x : Unix ms timestamp (1410715640579)
- gggg : Locale 4 digit week year (2014)
- gg : Locale 2 digit week year (14)
- w ww : Locale week of year (1..53)
- e : Locale day of week (0..6)
- ddd dddd : Day name in locale (Mon...Sunday)
- GGGG : ISO 4 digit week year (2014)
- GG : ISO 2 digit week year (14)
- W WW : ISO week of year (1..53)
- E : ISO day of week (1..7)
- H HH : 24 hour time (0..23)
- h hh : 12 hour time used with a A. (1..12)
- a A : Post or ante meridiem (Note the one character a p are also considered valid) (am pm)
- m mm : Minutes (0..59)
- s ss : Seconds (0..59)
- S SS SSS : Fractional seconds (0..999)
- Z ZZ : Offset from UTC as +-HH:mm, +-HHmm, or Z (+12:00)
Check if date string is valid
"Condition:Is valid" returns True if data string is valid. Set parameter "Strict mode" to "strict" to strict parsing requires that the format and input match exactly, including delimiters.
"Condition:Is valid" returns True if data string is valid. Set parameter "Strict mode" to "strict" to strict parsing requires that the format and input match exactly, including delimiters.
Get date displaying string by "Expression:Format", which returns date string with ISO 8601 format, Or add 2nd parameter to assign format.
Month
Month
- M : 1 2 ... 11 12
- Mo : 1st 2nd ... 11th 12th
- MM : 01 02 ... 11 12
- MMM : Jan Feb ... Nov Dec
- MMMM : January February ... November December
- Q : 1 2 3 4
- Qo : 1st 2nd 3rd 4th
- D : 1 2 ... 30 31
- Do : 1st 2nd ... 30th 31st
- DD : 01 02 ... 30 31
- DDD : 1 2 ... 364 365
- DDDo : 1st 2nd ... 364th 365th
- DDDD : 001 002 ... 364 365
- d : 0 1 ... 5 6
- do : 0th 1st ... 5th 6th
- dd : Su Mo ... Fr Sa
- ddd : Sun Mon ... Fri Sat
- dddd : Sunday Monday ... Friday Saturday
- e : 0 1 ... 5 6
- E : 1 2 ... 6 7
- w : 1 2 ... 52 53
- wo : 1st 2nd ... 52nd 53rd
- ww : 01 02 ... 52 53
- W : 1 2 ... 52 53
- Wo : 1st 2nd ... 52nd 53rd
- WW : 01 02 ... 52 53
- YY : 70 71 ... 29 30
- YYYY : 1970 1971 ... 2029 2030
- Y : 1970 1971 ... 9999 +10000 +10001 Note: This complies with the ISO 8601 standard for dates past the year 9999
- gg : 70 71 ... 29 30
- gggg : 1970 1971 ... 2029 2030
- GG : 70 71 ... 29 30
- GGGG : 1970 1971 ... 2029 2030
- A : AM PM
- a : am pm
- H : 0 1 ... 22 23
- HH : 00 01 ... 22 23
- h : 1 2 ... 11 12
- hh : 01 02 ... 11 12
- k : 1 2 ... 23 24
- kk : 01 02 ... 23 24
- m : 0 1 ... 58 59
- mm : 00 01 ... 58 59
- s : 0 1 ... 58 59
- ss : 00 01 ... 58 59
- S : 0 1 ... 8 9
- SS : 00 01 ... 98 99
- SSS : 000 001 ... 998 999
- SSSS ... SSSSSSSSS : 000[0..] 001[0..] ... 998[0..] 999[0..]
- X : 1360013296
- x : 1360013296123
Localized formats
Because preferred formatting differs based on locale, there are a few tokens that can be used to format a moment based on its locale.
There are upper and lower case variations on the same formats. The lowercase version is intended to be the shortened version of its uppercase counterpart.
Because preferred formatting differs based on locale, there are a few tokens that can be used to format a moment based on its locale.
There are upper and lower case variations on the same formats. The lowercase version is intended to be the shortened version of its uppercase counterpart.
- Time : LT (8:30 PM)
- Time with seconds : LTS (8:30:25 PM)
- Month numeral, day of month, year : L (09/04/1986), l (9/4/1986)
- Month name, day of month, year : LL (September 4 1986), ll (Sep 4 1986)
- Month name, day of month, year, time : LLL (September 4 1986 8:30 PM), lll (Sep 4 1986 8:30 PM)
- Month name, day of month, day of week, year, time : LLLL (Thursday, September 4 1986 8:30 PM). llll (Thu, Sep 4 1986 8:30 PM)
Escaping characters
To escape characters in format strings, you can wrap the characters in square brackets, like "[today] dddd".
To escape characters in format strings, you can wrap the characters in square brackets, like "[today] dddd".
Add
Sample capx
Call "Action:Add to" to add years, quarters, months, weeks, days, hours, minutes, seconds, milliseconds to current date value.
Sample capx
Call "Action:Add to" to add years, quarters, months, weeks, days, hours, minutes, seconds, milliseconds to current date value.
Get date
Get date value from these expressions
Get date value from these expressions
- Expression:Year
- Expression:Month ( 0..11 )
- Expression:Date
- Expression:Day
- Expression:Quarter
- Expression:Hours
- Expression:Minutes
- Expression:Seconds
- Expression:Milliseconds
- Expression:UnixTimestamp
Elapsed time
Get Elapsed time in years, quarters, months, weeks, days, hours, minutes, seconds, milliseconds by these expressions. Add 1 at 2nd parameter to get float result.
Get Elapsed time in years, quarters, months, weeks, days, hours, minutes, seconds, milliseconds by these expressions. Add 1 at 2nd parameter to get float result.
- Expression:ElapsedYears
- Expression:ElapsedMonths
- Expression:ElapsedDays
- Expression:ElapsedHours
- Expression:ElapsedMinutes
- Expression:ElapsedSeconds
- Expression:ElapsedMilliseconds
Start or end of date time
Sample capx
Get start or end of date after assigning date time by these expressions -
Start date time:
Sample capx
Get start or end of date after assigning date time by these expressions -
Start date time:
- Expression:StartOfYear
- Expression:StartOfMonth
- Expression:StartOfQuarter
- Expression:StartOfWeek
- Expression:StartOfISOWeek
- Expression:StartOfDate
- Expression:StartOfHour
- Expression:StartOfMinute
- Expression:StartOfSecond
- Expression:EndOfYear
- Expression:EndOfMonth
- Expression:EndOfQuarter
- Expression:EndOfWeek
- Expression:EndOfISOWeek
- Expression:EndOfDate
- Expression:EndOfHour
- Expression:EndOfMinute
- Expression:EndOfSecond
- Expression:StartOfYear , returns unix timestamp
- Expression:StartOfYear( "" ) , returns formatted data string
- Expression:StartOfYear( "iso" ) , returns date string in ISO format
- Expression:StartOfYear( string ) , returns custom formatted data string like "LLLL", see previous sections for more detail.