Thanks for the help Gabriel, I really appreciate it. That did the trick!

Regards

Mike

On Jun 22, 2015, at 10:38 AM, Gabriel Reid 
<gabriel.r...@gmail.com<mailto:gabriel.r...@gmail.com>> wrote:

Hi Michael,

Thanks for the very detailed explanation of your scenario.

I believe the issue is in your date format format string (yyyy-MM-DD). 
According to the Joda Time docs[1], "D" is the format specifier for day of year 
(and not day of month). If you use the format string "yyyy-MM-dd", things 
should work fine (similar to what you saw in your last example above).

- Gabriel


1. 
http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html

On Mon, Jun 22, 2015 at 5:07 PM Michael McAllister 
<mmcallis...@homeaway.com<mailto:mmcallis...@homeaway.com>> wrote:
Hi everyone

New user, first time post. I have a question about the TO_DATE function seeming 
to misbehave. I issue the following SQL statement:-

SELECT TO_DATE('2015-06-22','yyyy-MM-DD')
FROM system.catalog
LIMIT 1;

I get the following response:-

2015-01-21

Similarly, when I issue the following SQL statement:-

select TO_DATE('2015-05-12','yyyy-MM-DD')
FROM system.catalog
limit 1;

I get the following response:-

2015-01-11

My issue is not with the day being returned - I understand what’s going on 
there. My issue is with the MONTH that’s being returned.

Interestingly, things are OK if I issue the following SQL statement:-

SELECT TO_DATE('22 Jun 2015','d MMM yyyy')
FROM system.catalog
limit 1;

I get the following response:-

2015-06-21

Screenshot is attached. Phoenix version is 4.2 on HDP 2.2.

Regards

Mike

<1__homeaway_asthad011____ssh_.png>




<1__homeaway_asthad011____ssh_.png>

Reply via email to