Parse Date Function
The Parse Date function parses text representing a date or timestamp into a Julian timestamp that shows the number of milliseconds since 1/1/1970. The Date format field specifies the format of the text to evaluate. The format options are described in detail here: https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
One use of this function is to compare dates. Set two variables to the following values:
- Date1 = 01/04/2017
- Date2 = 10/11/2016
If you use a Greater Than or Less Than condition to test these dates, Date2 is the greater date because the values are compared as strings: 10 > 01. Comparing these values as dates is easy:
- Add a Parse Date function to each variable. These dates are formatted the same way, so the Parse Date function is the same for both variables, MM/dd/yyyy. If your date is represented with a different format, see Date and Time Patterns below for help determining the correct representation for your data.
- You can see in the Variables window that these values are converted to a Julian date representation that shows the number of milliseconds since 1 January 1970:
- Date1 and Date2 can now be compared.
More information of how to use the Parse Date function is available at https://minisoft.com/support/index.php/date-calculation-procedure-video-only/.
Parsing dates with “th”, “nd”, “rd”, “st” or other letter combinations
If a date is alphanumeric, use of eFORMz business rules (conditional logic) is likely necessary.
Letters must be escaped by quotes:
‘th,’
Date and Time Patterns
Letter |
Date or Time Component |
Presentation |
Examples |
G |
Era designator |
AD |
|
y |
Year |
1996; 96 |
|
M |
Month in year |
July; Jul; 07 |
|
w |
Week in year |
27 |
|
W |
Week in month |
2 |
|
D |
Day in year |
189 |
|
d |
Day in month |
10 |
|
F |
Day of week in month |
2 |
|
E |
Day in week |
Tuesday; Tue |
|
a |
Am/pm marker |
PM |
|
H |
Hour in day (0-23) |
0 |
|
k |
Hour in day (1-24) |
24 |
|
K |
Hour in am/pm (0-11) |
0 |
|
h |
Hour in am/pm (1-12) |
12 |
|
m |
Minute in hour |
30 |
|
s |
Second in minute |
55 |
|
S |
Millisecond |
978 |
|
z |
Time zone |
Pacific Standard Time; PST; GMT-08:00 |
|
Z |
Time zone |
-0800 |
|
X |
Time zone |
-08; -0800; -08:00 |