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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

convert date format of "created_at" from Twitter API to %Y-%m-%d %H:%M:%S

Hi Experts,

 

I want to convert the date format of "created_at" from twitter API to the format as "%Y-%m-%d %H:%M:%S", throuth Python or other ways.

 

I've downloaded Python and can use it on Power Query of BI.

 

Sorry for not knowing exact script of Python on BI, could you please kindly tell me the script?

 

Best regards.

1 ACCEPTED SOLUTION

@Anonymous 

I added a custom column in PQ to convert the given date-time to the desired format. Please check the attached file. You can do further formatting in Power BI once you load the table to the model.

let
m = Text.Middle([Column1],4,3),
d = Text.Middle([Column1],8,2),
y = Text.End([Column1],4),
t= Text.Middle([Column1],11,8)
in
DateTime.FromText ( y &"-"& m &"-"& d &" "& t 
)

 

Fowmy_0-1626762281206.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thank you for your quick reply!

It is the example of the date format of "created_at" column and the date format that I want to convert.

 

from

Wed Jun 30 14:54:36 +0000 2021

 

to

2021-6-30 14:54:36

 

Best regards,

@Anonymous 

I added a custom column in PQ to convert the given date-time to the desired format. Please check the attached file. You can do further formatting in Power BI once you load the table to the model.

let
m = Text.Middle([Column1],4,3),
d = Text.Middle([Column1],8,2),
y = Text.End([Column1],4),
t= Text.Middle([Column1],11,8)
in
DateTime.FromText ( y &"-"& m &"-"& d &" "& t 
)

 

Fowmy_0-1626762281206.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Dear Fowmy

 

It works!!

I really appreciate your help!

Fowmy
Super User
Super User

@Anonymous 

Can you share some sample dates for "Created Date"? This can be done using M in PQ

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors