Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Frixel
Post Prodigy
Post Prodigy

convert Timestamp to two colomns with date & time

Hi all,

 

I have this Timestamp (23-06-2020 09:12:22) also with ( )

Can i convert this in one step to a colomn with date and a colomn with time?

This noob have looking for a how to but couldn`t find it.

2 ACCEPTED SOLUTIONS
az38
Community Champion
Community Champion

Hi @Frixel 

try

 

Date Column = DATEVALUE(MID([Timestamp Column], 2, 10))

 

and

 

Time Column = TIMEVALUE(MID([Timestamp Column], 13, 8))

then format its columns as a date and time respectively in Column tools ribbon

 

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

v-eqin-msft
Community Support
Community Support

Hi @Frixel ,

According to my understanding, you want to split the Timestamp column into Date column and Time column without “(”,”)”,right?
For my example, I did it in two ways.

1.Using the following formula:

 

Date column =
LEFT ( SUBSTITUTE ( [Timestamp], "(", "" ), 10 )
Time column =
RIGHT ( SUBSTITUTE ( [Timestamp], ")", "" ), 7 )

 

And then change the two columns’ Data type from “Text” into “Date” and “Time” separately.
1.png

My example visualization looks like this:

2.png

2.Apply some steps in Query Editor(Advanced Editor)

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jDTNTLVNTIwMlAwsLQyNLIyMtJUitUBSljoGhljlTA00DUwh8sYG1gZGABlYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [TimeStamp = _t]),
    #"Replaced Value" = Table.ReplaceValue(Source,"(","",Replacer.ReplaceText,{"TimeStamp"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",")","",Replacer.ReplaceText,{"TimeStamp"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Replaced Value1",{{"TimeStamp", type datetime}}),
    #"Inserted Date" = Table.AddColumn(#"Changed Type", "Date", each DateTime.Date([TimeStamp]), type date),
    #"Inserted Time" = Table.AddColumn(#"Inserted Date", "Time", each DateTime.Time([TimeStamp]), type time)
in
#"Inserted Time"

 

3.png

Are these results what you want? If you have any questions, please upload some data samples and expected output.
Please do mask sensitive data before uploading.
Best Regards,
Eyelyn Qin

View solution in original post

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @Frixel ,

According to my understanding, you want to split the Timestamp column into Date column and Time column without “(”,”)”,right?
For my example, I did it in two ways.

1.Using the following formula:

 

Date column =
LEFT ( SUBSTITUTE ( [Timestamp], "(", "" ), 10 )
Time column =
RIGHT ( SUBSTITUTE ( [Timestamp], ")", "" ), 7 )

 

And then change the two columns’ Data type from “Text” into “Date” and “Time” separately.
1.png

My example visualization looks like this:

2.png

2.Apply some steps in Query Editor(Advanced Editor)

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jDTNTLVNTIwMlAwsLQyNLIyMtJUitUBSljoGhljlTA00DUwh8sYG1gZGABlYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [TimeStamp = _t]),
    #"Replaced Value" = Table.ReplaceValue(Source,"(","",Replacer.ReplaceText,{"TimeStamp"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",")","",Replacer.ReplaceText,{"TimeStamp"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Replaced Value1",{{"TimeStamp", type datetime}}),
    #"Inserted Date" = Table.AddColumn(#"Changed Type", "Date", each DateTime.Date([TimeStamp]), type date),
    #"Inserted Time" = Table.AddColumn(#"Inserted Date", "Time", each DateTime.Time([TimeStamp]), type time)
in
#"Inserted Time"

 

3.png

Are these results what you want? If you have any questions, please upload some data samples and expected output.
Please do mask sensitive data before uploading.
Best Regards,
Eyelyn Qin
az38
Community Champion
Community Champion

Hi @Frixel 

try

 

Date Column = DATEVALUE(MID([Timestamp Column], 2, 10))

 

and

 

Time Column = TIMEVALUE(MID([Timestamp Column], 13, 8))

then format its columns as a date and time respectively in Column tools ribbon

 

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.