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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
jaypatel
Helper III
Helper III

Extraer fecha y hora del texto


Hola a todos

Tengo una fecha como texto de tipo de datos. Quiero extraer la fecha y la hora de ese texto. Mi fecha es como "Mim 13 de mayo 12:06:29 UTC 2020". Intenté cambiar el tipo de datos desde el escritorio de Power BI, pero muestra un error y intenté con la función Text.Middle, pero tampoco funcionó para mí.
Ahora, ¿cómo puedo extraer la fecha y la hora del texto de la mención?

Gracias

Jay

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hola @jaypatel

Pruebe el siguiente script o vea el adjunto para el ref.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCk9NUfBNrFQwNFYwNLIyMLMyslQIDXFWMDIwMlCKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [DateTimeColumn = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each 
        let split = 
            Text.Split( [DateTimeColumn], " " ),
            dateTime = DateTime.FromText( split{5} & " " & split{1} & " " & split{2} & " " & split{3} )
        in 
            dateTime
    )
in
    #"Added Custom"

Saludos
Mariusz

Si este post ayuda,entonces por favor considere aceptarlo como la solución.

Por favor, siéntase libre de conectarse conmigo.
Linkedin

View solution in original post

1 REPLY 1
Mariusz
Community Champion
Community Champion

Hola @jaypatel

Pruebe el siguiente script o vea el adjunto para el ref.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCk9NUfBNrFQwNFYwNLIyMLMyslQIDXFWMDIwMlCKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [DateTimeColumn = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each 
        let split = 
            Text.Split( [DateTimeColumn], " " ),
            dateTime = DateTime.FromText( split{5} & " " & split{1} & " " & split{2} & " " & split{3} )
        in 
            dateTime
    )
in
    #"Added Custom"

Saludos
Mariusz

Si este post ayuda,entonces por favor considere aceptarlo como la solución.

Por favor, siéntase libre de conectarse conmigo.
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!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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