Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi all,
Using PBID April 2025.
I'm using a Python Script to export a dataframe to csv file
All of the date columns are returning Microsoft.OleDb.Date
So I need to convert all date columns to text before I export to csv
I tried DateToText. but it is swapping the the month to the day position
How do I retain the original date as a text string?
Thanks,
w
Solved! Go to Solution.
Guess I need to specify the format string
Date.ToText([CAMPAIGN_START_DATE], [Format="MM/dd/yyyy"])
A little odd that Month must be uppercase MM then day and year are lowercase.
Hi @tecumseh , Thank you for reaching out to the Microsoft Community Forum.
Try using Power Query’s Date.ToText() function with both a specified format string and culture setting. This avoids the issue where dates appear to swap month and day, due to locale-based formatting. For example, for a column like CAMPAIGN_START_DATE:
Date.ToText([CAMPAIGN_START_DATE], [Format="MM/dd/yyyy", Culture="en-US"])
Avoid using Text.From() in this scenario. While it does convert a date to text, it does not allow you to specify a custom format and instead uses the system’s locale settings. This means the month/day order could vary across environments, which is exactly the issue you're experiencing.
Please refer below documentation:
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Guess I need to specify the format string
Date.ToText([CAMPAIGN_START_DATE], [Format="MM/dd/yyyy"])
A little odd that Month must be uppercase MM then day and year are lowercase.
Hi @tecumseh ,
Alternatively try using Text.From()
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 4 |