Redwood Documentation

Product Documentation

 

›RedwoodScript

RunMyJobsRedwoodScript Development

Developing Applications

  • Developing Applications

RedwoodScript

  • RedwoodScript
  • Scripting in the Shell
  • Mixing REL and RS Code in a Library
  • Controlling Process Servers with RedwoodScript
  • Controlling Queues with RedwoodScript
  • Managing Applications with RedwoodScript
  • Substitution Parameters
  • Date Formatting and Parsing
  • Impact of Modified Process Definitions or Chain Definitions on Processes and Chains
  • Using the RedwoodScript Definition Type
  • Using RedwoodScript in Processes
  • Using Eclipse to Create and Edit Process Definitions

Debugging Your Code

  • Changing Process Logging Levels

Triggering Custom Code

  • Triggering Custom Code
  • Using Triggers
  • Trigger and Action Examples
  • Using Actions
  • Executing Your Own Classes from a Library
  • Library Examples
  • Extending Redwood Server Functionality with Extension Points
  • Extending Edit Pages with ObjectPageExtensionPoint
  • Creating Extension Points
  • Extending Redwood Server Functionality with Extension Points

Using Tables

  • Using Tables to Store Frequently Used Values

PL/SQL API

  • Cronacle PL/SQL API Module
  • Creating the OracleJob Process Server
  • Using the OracleJob Definition Type
  • Packages
  • RS/JCS Views

Tuning Redwood Platform

  • Tuning Redwood Platform

Memory Tuning

  • Tuning Memory Usage and Garbage Collection

Reference

  • Using SQL to Query the Data Model
  • Embed Redwood Server Overviews into Extension Points with the Embed API
  • API Documentation
  • Script Date Formats
  • Datamodel
  • Redwood Expression Language Functions and Implicit Objects
  • RedwoodScript Scripting Contexts and Implicit Objects
← Substitution ParametersImpact of Modified Process Definitions or Chain Definitions on Processes and Chains →

Specifying Date Formats

The DateTimeZone class uses the DateTimeFormatter for converting a date to text (formatting) and converting text to a date (parsing).

These conversion are based on patterns. uuuu/MM/dd HH:mm:ss,SSS i for example: 2023/03/02 15:45:44,998 Europe/Berlin

DateTimeFormatterMeaningPresentationDateTimeFormatter Examples
GEra designatorTextG - AD
uYearYearu, uuu, uuuu - 2023
uu - 23
uuuuu - 02023
yYear of eraNumbery, yyy, yyyy - 2023
yy - 23
yyyyy - 02023
DDay in yearNumberD,DD - 61
DDD - 061
M/LMonth in yearNumber/TextM - 3
MM - 03
MMM, MMMM - Mar
MMMMM - M
L - 3
LL - 03
LLL, LLLL - Mar
LLLLL - M
dDay in monthNumberd - 2
dd - 02
gmodified-julian-dayNumberg - 60005
Q/qquarter-of-yearnumber/textq - 1
qq - 01
qqq - Q1
qqqq - 1st quarter
qqqqq - 1
Q - 1
QQ - 01
QQQ - Q1
QQQQ - 1st quarter
QQQQQ - 1
Yweek-based-yearyearY, YYY, YYYY - 2023
YY - 23
YYYYY - 02023
wWeek in yearNumberw - 9
ww - 09
WWeek in monthNumberW - 1
EDay in weekTextE, EE, EEE - Thu
EEEE - Thursday
e/cDay number in week (Sunday is 1)Numbere - 5 (Thursday)
c - 5 (Thursday)
FDay of week in monthNumberF - 2
aAM/PM markerTexta - PM
Bperiod-of-dayTextB - in the afternoon
hHour in AM/PM (1-12)Numberh - 3
hh - 03
KHour in AM/PM (0-11)NumberK - 3
KK - 03
kHour in day (1-24)Numberk - 15
kk - 15
HHour in day (0-23)NumberH - 15
HH - 15
mMinute in hourNumberm, mm - 45
sSecond in minuteNumbers, ss - 44
SMillisecondNumberS - 9
SS - 99
SSS - 998
Amillisecond in dayNumberA - 56744998
nnano of secondNumbern - 998000000
Nnano of dayNumberN - 56744998000000
Vtime-zone IDTextVV - Europe/Berlin
vtime-zone IDGeneral time zonev - CET
zTime zoneGeneral time zonez, zz, zzz - CET
zzzz - Central European Standard Time
Olocalized zone offsetoffset-OO - GMT+1
XTime zoneISO 8601 time zoneX - +01
XX, XXX, XXXX, XXXXX - +01:00
ZTime zoneRFC 822 time zoneZ - +0100
ZZ, ZZZ - +0100
ZZZZ - GMT+01:00
ZZZZZ - +01:00
iOlson time zoneTexti - Europe/Berlin
'QuotingText, must be duplicated to escape'' - '
'some text' - some text
{<locale>}Prefix locale to use for the text elements of the date.text{de} uuuuMMdd EEEE - 20230302 Donnerstag
{fr} E - Mar

Escaping

To insert text in a date format, you specify '<text>', to insert a ' in the date format, you escape it with an ', so '' will be formatted as '. Note that if you are using REL, you must escape each ' with a \. You escape all literal characters you wish to insert into the date format.

Example

The given date and time are 2023-09-28 12:08:56 local time in the US Pacific Time time zone.

Java SimpleDateFormatResult
uuuu.MM.dd G 'at' HH:mm:ss z2023.07.04 AD at 12:08:56 PDT
EEE, MMM d, ''yyThu, Sep 28, '23
EEE, MMM d, ''uuWed, Jul 4, '23
EEE, MMM d, ''yyWed, Jul 4, '23
h:mm a12:08 PM
hh 'o''clock' a, zzzz12 o'clock PM, Pacific Daylight Time
K:mm a, z0:08 PM, PDT
yyyyy.MMMMM.dd GGG hh:mm a2023.Sep.28 AD 12:08 PM
{en} EEE, d MMM yyyy HH:mm:ss ZThu, 28 Sep 2023 12:08:56 -0700
{fr} EEE, d MMM yyyy HH:mm:ss ZThu, 28 Sep 2023 12:08:56 -0700
yyMMddHHmmssZ230928120856-0700
yyyy-MM-dd'T'HH:mm:ss.SSSZ2023-09-28T12:08:56.235-0700
yyyy-MM-dd'T'HH:mm:ssXXX2023-09-28T12:08:56-07:00
yyyy-'W'ww-e2023-W27-3
MM/dd/yyyy hh:mm:ss VV07/04/2023 12:08:56 America/Los Angeles
=Time.format(Time.now('Europe/Paris'), 'dd/MM/uuuu hh:mm:ss i')28/09/2023 21:08:56 Europe/Paris
=Time.format(Time.now('America/Los Angeles'), 'yyyyMMddHHmm')202309281208
=Time.format(Time.now('America/Los Angeles'), 'yyyy.MM.dd.HH-mm-ss')2023.09.28.12-08-56
=Time.format(Time.now('America/Los Angeles'), 'EEE-dd-MM-yy')Thu-28-09-23
=Time.format(Time.now('America/Los Angeles'), 'hmma')1208PM
=Time.format(Time.now('Europe/Paris'), 'dd MM \'\'yy hh:mm:ss VV')28 09 '23 21:08:56 Europe/Paris

Important Changes in 9.2.9 and Later

The Java SimpleDateFormat class was used to format and parse DateTimeZone objects up until version 9.2.8 (inclusive). An example for a dynamic date using Java SimpleDateFormat would be the following:

=Time.format(Time.now('America/Los Angeles'),'yyyyMMdd')

This would be safest to specify as =Time.format(Time.now('America/Los Angeles'),'uuuuMMdd') to correctly account for leap years.

You can also use the Time.format() REL function as follows, note that it also accepts the i to included the time zone:

=Time.format(Time.now('America/Los Angeles'), 'dd/MM/yyyy HH:mm:ss i')

Result:

2023/09/28 11:14:10 Europe/Paris

That would be expressed as the following with DateTimeFormatter

=Time.format(Time.now('America/Los Angeles'), 'dd/MM/uuuu HH:mm:ss i')

Result:

2023/09/28 11:14:10 Europe/Paris
note

The yyyy does not always account for leap years, for example when STRICT parsing is used. The uuuu syntax is recommended.

The following table lists all valid letters that can be used to form a pattern which represents the date format.

The current date is: 2023/03/02 15:45:44,998 Europe/Berlin (yyyy/MM/dd HH:mm:ss,SSS i)

SimpleDateFormatDateTimeFormatterMeaningPresentationDateTimeFormatter Examples

uYearYearu, uuu, uuuu - 2023
uu - 23
uuuuu - 02023
ue/cDay number in week (Sunday is 1)Numbere - 5 (Thursday)
c - 5 (Thursday)

Important Differences

  • Superfluous repetitions of letters cause exceptions.
  • You must escape all literal characters in the format.
  • u is no longer day number of week but year, use e or c instead.
  • Use of u instead of y is recommended to cater for leap years.
Example of superfluous repetitions
{
  String DATE_FORMAT = "EEE, MMM d, hh:mm:ss aa";
  DateTimeZone dtz = new DateTimeZone();
  String creationTime = dtz.toFormattedString(DATE_FORMAT);
  jcsOut.println(creationTime);
}

In verion 9.2.8 and lower, the above worked, notice the aa (repetition is superfluous, here, as a would have worked as well). This does not work in 9.2.9 and later.

See Also

  • REL Function Library
  • Querying the Model with SQL
← Substitution ParametersImpact of Modified Process Definitions or Chain Definitions on Processes and Chains →
  • Escaping
  • Example
  • Important Changes in 9.2.9 and Later
    • Important Differences
  • See Also
Docs
Getting StartedInstallationFinance InstallationConcepts
TroubleshootingArchiving
Learn and Connect
Support Portal
BlogEventsResources
ISO/ IEC 27001 Information Security Management
Automate to be human

2023 All Rights Reserved |

Terms of Service | Policies | Cookies | Glossary | Third-party Software | Contact | Copyright | Impressum |