Date Conversion

Best Answers
-
You can get this formatted as a date field by using the STR_TO_DATE() function like this:
STR_TO_DATE(yourfield, '%a, %d %b %Y %h:%i %p')
You can use the monthname function around this function to extract the month name, but that will be a string value since it is text.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
You can do this, but its going to add '1, 0001' for days and year.
STR_TO_DATE(MONTHNAME(
[your date column]
), '%M')Can you explain why you need it to be a date column? Maybe there is a round about way to achieve what you're trying
0 -
Hi @TMonty0319,
This should do the trick:
DATE_FORMAT(STR_TO_DATE(TRIM(SUBSTRING(<your date field>,INSTR(<your date field>,',')+1)), '%d %b %Y %H:%i %p'),'%Y-%m-%d %H:%i:%s')
This finds the first occurrence of the comma in your string and removes the day abbreviation since you dont really need that (since the day month and year follow it). We then trim it to remove any leading/trailing spaces and apply STR_TO_DATE to convert it to a datetime. However that leaves you with a unix style timestamp. So we then apply ISO date format to normalize it to a standard datetime using DATE_FORMAT. I hope this helps
0
Answers
-
You can get this formatted as a date field by using the STR_TO_DATE() function like this:
STR_TO_DATE(yourfield, '%a, %d %b %Y %h:%i %p')
You can use the monthname function around this function to extract the month name, but that will be a string value since it is text.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
You can do this, but its going to add '1, 0001' for days and year.
STR_TO_DATE(MONTHNAME(
[your date column]
), '%M')Can you explain why you need it to be a date column? Maybe there is a round about way to achieve what you're trying
0 -
Hi @TMonty0319,
This should do the trick:
DATE_FORMAT(STR_TO_DATE(TRIM(SUBSTRING(<your date field>,INSTR(<your date field>,',')+1)), '%d %b %Y %H:%i %p'),'%Y-%m-%d %H:%i:%s')
This finds the first occurrence of the comma in your string and removes the day abbreviation since you dont really need that (since the day month and year follow it). We then trim it to remove any leading/trailing spaces and apply STR_TO_DATE to convert it to a datetime. However that leaves you with a unix style timestamp. So we then apply ISO date format to normalize it to a standard datetime using DATE_FORMAT. I hope this helps
0 -
I just need the month name. So from this - Thu, 29 Feb 2024 11:59 PM i need a formula for a new column that just has February and is in Date Format.
0
Categories
- All Categories
- 1.9K Product Ideas
- 1.9K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 305 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3K Transform
- 107 SQL DataFlows
- 648 Datasets
- 2.2K Magic ETL
- 4K Visualize
- 2.5K Charting
- 775 Beast Mode
- 75 App Studio
- 43 Variables
- 734 Automate
- 186 Apps
- 471 APIs & Domo Developer
- 63 Workflows
- 14 DomoAI
- 40 Predict
- 17 Jupyter Workspaces
- 23 R & Python Tiles
- 403 Distribute
- 117 Domo Everywhere
- 277 Scheduled Reports
- 9 Software Integrations
- 137 Manage
- 134 Governance & Security
- 8 Domo Community Gallery
- 44 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 113 Community Announcements
- 4.8K Archive