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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
crwinchester
Helper I
Helper I

Why is it nearly impossible to convert this datetime text to a date/time field?

I've tried way too many combinations of formulas for text data that is formatted like this: 01/01/2024 1:23 AM PST. There is nothing that I've found that will provide the correct results. It even stumped Claude.ai! If there is anyone here that knows how it is possible to convert this seemingly basic format to useable data I would greatly appreciate it! Here is a sample of my table:

 

User NameEmail IDLogin/Access TimeLogout/Left Time
A0email0001/01/2024  1:23 AM PST01/26/2024  2:44 PM PST
A1email0101/01/2024  1:23 AM PST01/26/2024  2:44 PM PST
A2email0201/01/2024  5:21 AM PST02/29/2024 10:03 PM PST
A3email0301/01/2024  7:50 AM PST02/15/2024 10:03 PM PST
A4email0401/01/2024  7:55 AM PSTStill Logged In 
A5email0501/01/2024  8:08 AM PST02/15/2024 10:03 PM PST
A6email0601/01/2024  8:23 AM PSTStill Logged In 
A7email0701/01/2024  8:36 AM PST02/15/2024 10:03 PM PST
A8email0801/01/2024  8:51 AM PST02/15/2024 10:03 PM PST
A9email0901/01/2024  9:32 AM PST01/04/2024  4:58 PM PST
A10email1001/01/2024  9:34 AM PST01/03/2024  3:29 PM PST
A11email1101/01/2024  9:50 AM PST01/03/2024  3:29 PM PST
A12email1201/01/2024 10:00 AM PST01/18/2024  9:56 AM PST
A13email1301/01/2024 10:03 AM PST01/03/2024  3:29 PM PST
A14email1401/01/2024 10:05 AM PST02/15/2024 10:03 PM PST
A15email1501/01/2024 10:07 AM PST01/03/2024  3:29 PM PST
A16email1601/01/2024 10:27 AM PST01/07/2024  2:57 PM PST
A17email1701/01/2024 10:29 AM PST02/22/2024 10:03 PM PST
A18email1801/01/2024 10:30 AM PST01/26/2024  2:22 PM PST
1 ACCEPTED SOLUTION
bchager
Super User
Super User

@crwinchester Does this solution work for you?

 

View solution in original post

2 REPLIES 2
bchager
Super User
Super User

@crwinchester Does this solution work for you?

 

Thanks @bchager. You really went above and beyond! This definitely solves it. From the perspective of a novice user, it's pretty frustrating that you have to write out such a complicated function to arrive at something that appears so simple (from your solution):

let
    // Original text
    Source = [#"Login/Access Time"],
    // Replace the timezone abbreviation (PST) with its UTC offset (-08:00)
    ReplaceTimeZone = Text.Replace(Source, "PST", "-08:00"),
    // Parse the text into a DateTimeZone value
    ConvertToDateTimeZone = DateTimeZone.FromText(ReplaceTimeZone),
    // Remove the timezone information to convert it to a DateTime
    ConvertToDateTime = DateTimeZone.RemoveZone(ConvertToDateTimeZone)
in
    ConvertToDateTime

It feels like you're fixing something that should been in the app to begin with as a button, am I right (Microsoft)?

 

At any rate, I ended up converting the data in Excel in a new column using a single formula (applies to both date text fields where there are nonconforming formats):

=VALUE(IF(LEN(C2)=23,LEFT(C2,19),"null"))

Then I just changed the field type to date with appropriate format, and brought back into PowerBI.

 

Perhaps if I need to connect to a much larger data set where preparing in Excel isn't an option, this formulaic approach will be better. I definitely learned a lot! I really appreciate your time!

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors