Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All ,
The below command is not working properly with YYYY and the same is working good with yyyy
TalendDate.parseDate("MMM dd YYYY",TalendDate.getDate("MMM dd yyyy")
TalendDate.parseDate("MMM dd yyyy",TalendDate.getDate("MMM dd yyyy")
Can someone suggest the purpose of YYYY and when can i use and why it is giving invalid result.
Thanks,
Bharath
Hi Bharat,
since java is case sensitive so YYYY does not work for it.
The date format always has dd MM yyyy .
Let me know more about your requirement.
Regards,
Neha
hi neha,
Here there is no requirement .both commands are working properly, but
YYYY is not giving correct result and yyyy is giving correct result,
may i know the reason why YYYY is not throwing error and giving junk value or any significance for YYYY
Hi,
Well I have faced error saying : Invalid character near 'Y' , whenever I have used YYYY by mistake in my date formats instead of yyyy.
Like for exmaple, M is always capital and d is always small in a date format ,similarly y is always small. It will simply not work with capital Y because its something in-built in java, as far as my knowledge is concerned.
I wish I could help you more in this by seeing any screen-shot and figure out the exact issue. let me know if I can solve more.
Thanks,
Neha
Hi,
"yyyy" stands for Year in Java Date. You can get date pattern from schema setting.
Please have a look at my screenshot.
Best regards
Sabrina
Hi ,
The command i posted, it is not throwing any parsing error and it is working fine and giving improper result.
Thanks,
Bharath
yyyy is stands for year and wat about YYYY and why it is not throwing error.
YYYY is giving result which is not correct result and the result for YYYY is on what basis caluclated.
https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
According to the Java docs, 'Y' represents "Week Year" which is slightly different from 'y'.
This stackoverflow article goes into more detail:
https://stackoverflow.com/questions/8686331/y-returns-2012-while-y-returns-2011-in-simpledateformat
Hello,
Thanks for sharing the related docs with us.
Best regards
Sabrina