Forum Discussion
Amazing_Random
Helper I
3 years agoFormatting date text string to a custom format
For a report I have to use a link into the meter name. I have been able to crack down the id aspect of the link. but the date on such link is quite off to the date/time formats in PBI. &chartEndDa...
- 3 years ago
Do you need something like this? This formula uses the UTCNOW() function to get the current UTC time and the FORMAT function to format the datetime in the desired format. You can replace UTCNOW() function with the column you have.
Column = CONCATENATE( FORMAT(UTCNOW(), "yyyy-MM-ddT"), SUBSTITUTE( FORMAT(UTCNOW(), "HH:mm:ss.fffZ"), ":", "%3A" ) )
ryan_mayu
Super User
3 years agodoes that mean you want to convert "2023-01-10T19%3A00%3A00.000Z " to "10/01/2023 5:30:00pm"?
- Amazing_Random3 years ago
Helper I
The opposite! I need to convert "10/01/2023 5:30:00pm" to "2023-01-10T19%3A00%3A00.000Z " for the link to work
Edit: I understand the hours are different, just an example- ryan_mayu3 years ago
Super User
could you pls explain the converting logic?
the first part before T is easier to understand. How about the part after letter T?
- Ahmedx3 years ago
Super User
Column = VAR _t1 = LEFT ( [datetime], SEARCH ( "T", [datetime], 1 ) - 1 ) VAR _t2 = SUBSTITUTE ( _t1, "-", "|" ) RETURN DATE ( PATHITEM ( _t2, 1, INTEGER ), PATHITEM ( _t2, 3, INTEGER ), PATHITEM ( _t2, 2 , INTEGER ) )