|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
CAST DATE FORMAT |
« View previous topic :: View next topic » |
Author |
Message
|
Phanikumar |
Posted: Tue Jul 17, 2018 10:05 pm Post subject: CAST DATE FORMAT |
|
|
 Apprentice
Joined: 29 Aug 2016 Posts: 25 Location: Kuwait
|
Hi All,
How to cast the date format dd-MM-yyyy to yyyy-MM-dd in ESQL. I've tried double cast but nothing is working. _________________ Saying what you feel. It's not being rude, it's called being real. |
|
Back to top |
|
 |
abhi_thri |
Posted: Tue Jul 17, 2018 10:40 pm Post subject: |
|
|
 Knight
Joined: 17 Jul 2017 Posts: 516 Location: UK
|
hi...if the input field is of date/timestamp type you can convert it to string using FORMAT as described at the infocenter topic
If the input is not a date then you need to cast it to date first followed by FORMAT to string operation,
CAST(CAST(inputDate AS DATE FORMAT 'dd-MM-yyyy') AS CHAR FORMAT 'yyyy-MM-dd'); |
|
Back to top |
|
 |
timber |
Posted: Wed Jul 18, 2018 1:24 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
I've tried double cast but nothing is working |
That is not a good problem statement. If you want help with a technical problem, you will need to invest more time in describing what you did, and what happened. |
|
Back to top |
|
 |
Phanikumar |
Posted: Wed Jul 18, 2018 5:37 am Post subject: |
|
|
 Apprentice
Joined: 29 Aug 2016 Posts: 25 Location: Kuwait
|
timber wrote: |
Quote: |
I've tried double cast but nothing is working |
That is not a good problem statement. If you want help with a technical problem, you will need to invest more time in describing what you did, and what happened. |
I tried CAST (CAST(cSlDate AS CHAR FORMAT) AS CHAR FORMAT 'yyyy-MM-dd'); however, I've got this.
Next time i post with more descriptions. Thanks for your reply. _________________ Saying what you feel. It's not being rude, it's called being real. |
|
Back to top |
|
 |
Phanikumar |
Posted: Wed Jul 18, 2018 5:38 am Post subject: |
|
|
 Apprentice
Joined: 29 Aug 2016 Posts: 25 Location: Kuwait
|
abhi_thri wrote: |
hi...if the input field is of date/timestamp type you can convert it to string using FORMAT as described at the infocenter topic
If the input is not a date then you need to cast it to date first followed by FORMAT to string operation,
CAST(CAST(inputDate AS DATE FORMAT 'dd-MM-yyyy') AS CHAR FORMAT 'yyyy-MM-dd'); |
Thank You, I've tried and it's working. _________________ Saying what you feel. It's not being rude, it's called being real. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|