'How to format 2 string columns into date time value using Azure mapping data flows

Can you please help me with my problem ,

I have 2 columns Tran_date & Tran time like below which are feeding from my source as a string value without special characters to separate month,date &year similarly tran_time for time . Now how can i transform them as a datetime value like shown in below example using Azure Data Flows.

Input |Tran_date|Tran_date| |---------|---------| |01242022|064033| |01222022|051003|

Output |Der_datetime| |------------| |01-24-2022 06:40:33| |01-22-2022 05:10:03|



Solution 1:[1]

You can use derived column transformation in the data flow to convert the string to date time.

  1. Using concat() function, combine the 2 columns Tran_date & Tran_time and then convert to datetime using toTimestamp().

toTimestamp() function returns the default format as yyyy-MM-dd hh:mm:ss:SSS. If you want the DateTime in a different format, you can provide the output format later in sink transformation under mappings.

enter image description here

  1. Using select transformation, you can delete unwanted columns which are passed to output/sink. (this is optional alternatively, you can edit the mappings in sink transformation to delete unwanted columns)

enter image description here

Select transformation preview:

enter image description here

  1. In sink transformation, under mapping, you can provide your required DateTime output format as shown below.

enter image description here

Sink preview:

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1