03-25-2019 05:13 PM
The expressions for database datetime conversions listed in the topic SnapLogic DateTime Conversion Guidelines can be updated as follows to build an expression library:
{
/*
* Database DateTime Conversions
* Sample conversions between the SnapLogic DATETIME variable and several known 3rd party data types normalized to the US/Pacific time zone.
*/
toRedshiftDate: x => LocalDate.parse(x.toLocaleDateString({"timeZone":"US/Pacific”})) ,
toRedshiftTimestamp: x => LocalDateTime.parse(x.toLocaleDateTimeString({"timeZone":"UTC”})) ,
toMongoDBDateTime: x => LocalDateTime.parse(x.toLocaleDateTimeString({"timeZone":"US/Pacific”})) ,
toMySQLDate: x => LocalDate.parse(x.toLocaleDateString({“timeZone”:"US/Pacific”})) ,
toMySQLDateTime: x => LocalDateTime.parse(x.toLocaleDateTimeString({“timeZone”:"UTC”})) ,
toMySQLTime: x => LocalTime.parse(x.toLocaleTimeString({“timeZone”:"US/Pacific”})) ,
toMySQLTimeStamp: x => LocalDateTime.parse(x.toLocaleDateTimeString({“timeZone”:"US/Pacific”})) ,
toOracleDate: x => LocalDate.parse(x.toLocaleDateString({“timeZone”:"US/Pacific”})) ,
toOracleTimeStamp: x => LocalDateTime.parse(x.toLocaleDateTimeString({“timeZone”:"UTC”})) ,
toOracleTimeStampTMZ: x => LocalDateTime.parse(x.toLocaleDateTimeString({“timeZone”:"US/Pacific”})) ,
toOracleTimeStampLocalTMZ: x => LocalDateTime.parse(x.toLocaleDateTimeString({“timeZone”:"US/Pacific”})) ,
toPostgresDate: x => LocalDate.parse(x.toLocaleDateString({“timeZone”:"US/Pacific”})) ,
toPostgresTime: x => LocalTime.parse(x.toLocaleTimeString({“timeZone”:"UTC”})) ,
toPostgresTimeTMZ: x => LocalTime.parse(x.toLocaleTimeString({“timeZone”:"US/Pacific”})) ,
toPostgresTimeStamp: x => LocalDateTime.parse(x.toLocaleDateTimeString({“timeZone”:"UTC”})) ,
toPostgresTimeStampTMZ: x => LocalTime.parse(x.toLocaleTimeString({“timeZone”:"US/Pacific”})) ,
toSAPHANADate: x => LocalDate.parse(x.toLocaleDateString({“timeZone”:"US/Pacific”})) ,
toSAPHANATime: x => LocalTime.parse(x.toLocaleTimeString({“timeZone”:"US/Pacific”})) ,
toSAPHANASecondDate: x => LocalDateTime.parse(x.toLocaleDateTimeString({“timeZone”:"UTC”})) ,
toSAPHANATimeStamp: x => LocalDateTime.parse(x.toLocaleDateTimeString({“timeZone”:"UTC”})) ,
toSalesforceDate: x => LocalDate.parse(x.toLocaleDateString({“timeZone”:"US/Pacific”})) ,
toSalesforceDateTime: x => LocalDateTime.parse(x.toLocaleDateTimeString({“timeZone”:"UTC”})) ,
toSalesforceTime: x => LocalTime.parse(x.toLocaleTimeString({“timeZone”:"US/Pacific”})) ,
toSQLDateTime: x => LocalDateTime.parse(x.toLocaleDateTimeString({“timeZone”:"UTC”})) ,
toSQLDateTime2: x => LocalDateTime.parse(x.toLocaleDateTimeString({“timeZone”:"UTC”}))
}