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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Date exctracting from specific timestamp

Hi community, 

 

Would you please give me advice what is the best way to extract the date from this specific timespamp:

 

P2019Y3M11DT11H4M54S

 

I've tried to use MID function to exctract the parts and concatenate them by ".": 

 

Date =

MID ( Test_table[orderDate] ; SEARCH ( "M" ; Test_table[orderDate] ) + 1 ; SEARCH ( "D" ; Test_table[orderDate] ) - SEARCH ( "M" ; Test_table[orderDate] ) - 1 ) & "." &
MID ( Test_table[orderDate] ; SEARCH ( "Y" ; Test_table[orderDate] ) + 1 ; SEARCH ( "M" ; Test_table[orderDate] ) - SEARCH ( "Y" ; Test_table[orderDate] ) - 1 ) & "." &
MID ( Test_table[orderDate] ; SEARCH ( "P" ; Test_table[orderDate] ) + 1 ; 4 )
 
As result I received a text string "11.3.2019", but not able to change the format to Date.
 
Would be really appreciate for your help.
 
Thank you!
1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

I would do something like this:

DATE(
    VALUE(< something that returns the year >)
    ,VALUE(< something that returns the month >)
    ,VALUE(< something that returns the day >)
)

Regards,
Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thank you guys, now it works!

TomMartens
Super User
Super User

Hey,

 

I would do something like this:

DATE(
    VALUE(< something that returns the year >)
    ,VALUE(< something that returns the month >)
    ,VALUE(< something that returns the day >)
)

Regards,
Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
AliH
Frequent Visitor

Hi Egor,

 

test:=date(mid("P2019Y3M11DT11H4M54S",find("P","P2019Y3M11DT11H4M54S")+1,4),mid("P2019Y3M11DT11H4M54S",find("M","P2019Y3M11DT11H4M54S")+1,2),mid("P2019Y3M11DT11H4M54S",find("Y","P2019Y3M11DT11H4M54S")+1,1))

 

Probably not the best way, but this works.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.