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 to any 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 to any 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.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 295 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 98 SQL DataFlows
- 608 Datasets
- 2.1K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 713 Beast Mode
- 50 App Studio
- 39 Variables
- 669 Automate
- 170 Apps
- 447 APIs & Domo Developer
- 45 Workflows
- 7 DomoAI
- 34 Predict
- 14 Jupyter Workspaces
- 20 R & Python Tiles
- 391 Distribute
- 111 Domo Everywhere
- 274 Scheduled Reports
- 6 Software Integrations
- 116 Manage
- 113 Governance & Security
- Domo Community Gallery
- 31 Product Releases
- 9 Domo University
- 5.3K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 104 Community Announcements
- 4.8K Archive