DATE_FORMAT SQL Issue

Reply
Highlighted
Yellow Belt

DATE_FORMAT SQL Issue

Hi There,

 

I'm tyring to convert my date field from a 12 hour time stamp, to a 24 hour timestamp. I tried using DATE_FORMAT(`Date Field`, '%Y-%m-%d %H:%m:%s') but it gives me a completely different date AND time than what the actual value is. 


Has anyone ever encountred a similar issue and have any advice. Thanks!

Highlighted
Brown Belt

Re: DATE_FORMAT SQL Issue

The documentation found in the Knowledge Base has always helped me when it comes to formating my dates/times: https://knowledge.domo.com/Visualize/Adding_Cards_to_Domo/KPI_Cards/Transforming_Data_Using_Beast_Mo...

 

To convert to 24 hour try:

 

DATE_FORMAT('Date Field', '%T')

Let me know if this helps!

Highlighted
Yellow Belt

Re: DATE_FORMAT SQL Issue

Thanks for your response! My issue is that when I use any of those functions, it completely changes the date. For example, the date 10/2/2019 8:14 PM becomes 2019-10-03 01:07:30 when using the funciton DATE_FORMAT(`Date Field`, '%Y-%m-%d %T'). Is there some sort of additional calculation I should be doing? 

Highlighted
Brown Belt

Re: DATE_FORMAT SQL Issue

It must be something with the data type of the date. What data type does it say it is?

Announcements
Coming Soon: Weekly Virtual User Meet-ups to answer all your questions! Stay tuned for more details to come this week.