transformDate

transformDate ( string txtDate , string formatFrom , string formatTo , string _localeFrom , string _localeTo ) : string

Transform a string date in another string date (or a date type if formatTo=date)
It manages text mounth in english and french

Example


date_timestamp = transformDate(order_date, "yyyy-MM-dd", "timestamp")


See also

nowFormat
formatDate

Parameters

txtDate

formatFrom

see formatTo

formatTo

Special values : "date" = returns the java Date object. "timestamp" = returns the timestamp in milliseconds. Example : yyyy.MM.dd H:mm:ss
date_1 = "The 09 on the mounth 01 on the year 1971"

// I want to transform all dates with this format in this format : 09/01/1971


console(transformDate(date_1, "'The 'dd' on the mounth 'MM' on the year 'yyyy", "dd/MM/yyyy")) // -> 09/01/1971
Symbol Meaning Presentation Example
G era designator Text AD
y year Number 2009
M month in year Text & Number July (MMM) & 07 (MM)
d day in month Number 10
h hour in am/pm (1-12) Number 12
H hour in day (0-23) Number 0
m minute in hour Number 30
s second in minute Number 55
S millisecond Number 978
E day in week Text Tuesday
D day in year Number 189
F day of week in month Number 2 (2nd Wed in July)
u day of the week in number Number 3 (1 = Monday, 7 = Sunday)
w week in year Number 27
W week in month Number 2
a am/pm marker Text PM
k hour in day (1-24) Number 24
K hour in am/pm (0-11) Number 0
z time zone Text Pacific Standard Time
escape for text Delimiter (none) single quote Literal (ex:yyyy 'year')

_localeFrom (optional)

Default:"en". Language code of the original format (ex: "en", "fr", "it", "de", etc.)

_localeTo (optional)

Default:"en". Language code of the destination format (ex: "en", "fr", "it", "de", etc.)