You can translate the question and the replies:

Convert the incoming date in Text format to DateTime using the TO_DATE function

Hello, I have a question regarding the conversion of incoming Text format to a Denodo Date format using the TO_DATE function. The field name is <fld_name>. And, a sthe incoming date values are: 5/1/2018 1:41 PM 5/1/2018 12:59 PM 5/1/2018 11:45 AM Using the TO_DATE function TO_DATE('MM/dd/yyyy HH:mm a',<fld_name>) I get the resulting values without the "AM" or "PM" at the end. What is the correct format to use to get the AM/PM at the end of the time value in this field.
user
26-06-2018 12:41:50 -0400
code

1 Answer

Hi, I would consider using the FORMATDATE function as a part of your TO_DATE function. I say this because it allows the Java date and time patterns to be used as needed. The documentation on FORMATDATE can be found [here](https://community.denodo.com/docs/html/browse/7.0/vdp/vql/appendix/syntax_of_condition_functions/date_processing_functions#formatdate). One of the examples shown in that link is this: ``` SELECT date, formatdate('h:mm a', date) AS format_date FROM v ``` | date | format_date | | -------- | -------- | | Jun 29, 2005 19:19:41 | 7:19 PM | Hope this helps!
Denodo Team
27-06-2018 12:43:41 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here