Converting Dates – Masking

It’s a common task to convert dates found in external sources to the PDI/Apache Hop date format. While PDI/Apache Hop offers some typcial conversion masks as a drop down, you may need to create an own one. Here a cheat sheet how to use the masking parameters:

SymbolMeaningTypeExample
GEraText“GG” -> “AD”
yYearNumber“yy” -> “03””yyyy” -> “2003”
MMonthText or Number“M” -> “7””M” -> “12””MM” -> “07””MMM” -> “Jul””MMMM” -> “December”
dDay in monthNumber“d” -> “3””dd” -> “03”
hHour(1-12, AM/PM)Number“h” -> “3””hh” -> “03”
HHour (0-23)Number“H” -> “15””HH” -> “15”
kHour (1-24)Number“k” -> “3””kk” -> “03”
KHour (0-11, AM/PM)Number“K” -> “15””KK” -> “15”
mMinuteNumber“m” -> “7””m” -> “15””mm” -> “15”
sSecondNumber“s” -> “15””ss” -> “15”
SMillisecond (0-999)Number“SSS” -> “007”
EDay in weekText“EEE” -> “Tue””EEEE” -> “Tuesday”
DDay in year (1-365 or 1-364)Number“D” -> “65””DDD” -> “065”
FDay of week in month (1-5)Number“F” -> “1”
wWeek in year (1-53)Number“w” -> “7”
WWeek in month (1-5)Number“W” -> “3”
aAM/PMText“a” -> “AM””aa” -> “AM”
zTime zoneText“z” -> “EST””zzz” -> EST””zzzz” -> Eastern Standard Time”
XTime zone offsetText“XXX” -> “-08:00”
Escape for textDelimiter“hour’h” -> “hour 9”
Single quoteLiteral“ss”SSS” -> “45’876”. Use two quote marks in a row to create a single quote in a string.
Source: https://help.hitachivantara.com/Documentation/Pentaho/9.2/Products/Common_Formats