# Issue with @pxFormatDateOnly function yields incorrect Year

**URL:** <https://forums.pega.com/t/issue-with-pxformatdateonly-function-yields-incorrect-year/8965>\
**Category:** User Experience\
**Tags:** low-code-app-development, healthcare-and-life-sciences, user-experience, pega-platform, senior-system-architect\
**Created:** [February 6, 2025, 12:44pm UTC](https://forums.pega.com/t/issue-with-pxformatdateonly-function-yields-incorrect-year/8965 "2025-02-06T12:44:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SakhibHussain](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/sakhibhussain/32/23433_2.png) [@SakhibHussain](https://forums.pega.com/u/SakhibHussain)\
**Post date:** [February 6, 2025, 12:44pm UTC](https://forums.pega.com/t/issue-with-pxformatdateonly-function-yields-incorrect-year/8965/1 "2025-02-06T12:44:46Z")

</div>

Hi All,

The function returns incorrect year when executed. When the Date string is “20241231” which is yyymmdd format and if I use the function @pxFormatDateOnly with @pxFormatDateOnly(“20241231”,“yyyyMMdd”,“dd-MMM-YYYY”) it returns incorrect date as 31-Dec-2025. See the attachment.

Can somebody help me on this?

Thanks in advance.

Regards,

Sakhib Hussain

 ![IncorrectYear.PNG](https://pega1.discourse-cdn.com/pega/original/2X/8/847653769bdfc3dd9b17651f760e4a74c3875f27.png)

---

<div class="post-metadata">

**Author:** ![SohamM95](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/sohamm95/32/4726_2.png) [@SohamM95](https://forums.pega.com/u/SohamM95)\
**Post date:** [February 6, 2025, 3:48pm UTC](https://forums.pega.com/t/issue-with-pxformatdateonly-function-yields-incorrect-year/8965/2 "2025-02-06T15:48:55Z")

</div>

@SakhibHussain

Yes there’s an issue with the Pega platform code where this happens. We raised a ticket on this and the reply was that the year format we have to use lower case y instead of upper case Y. In your case, try with using “dd-MMM-yyyy”.

---

<div class="post-metadata">

**Author:** ![SakhibHussain](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/sakhibhussain/32/23433_2.png) [@SakhibHussain](https://forums.pega.com/u/SakhibHussain)\
**Post date:** [February 7, 2025, 9:00am UTC](https://forums.pega.com/t/issue-with-pxformatdateonly-function-yields-incorrect-year/8965/3 "2025-02-07T09:00:01Z")

</div>

@SohamM95 Thanks. This solved
