How to Convert Date of Format YYYY-MM-DD into DD-MMM-YYYY

Is there any OOTB function available in pega to convert the date of format YYYY-MM-DD into DD-MMM-YYYY or vice versa?

Example : Input Date : 2021-08-25

Out Date Should be : 25-Aug-2021

@AmbrishP7171 You can try using formatdatetime function.

@Bhavya

I have used the @FormatDateTime() Function but no luck. it is returning wrong date.

Function I used: @DateTime.FormatDateTime(@DateTime.CurrentDateTime(),“DD-MMM-YYYY”,null,null)

Out put : 237-Aug-2021

Please let me know if you have any another solution it would be great.

@AmbrishP7171 See below screenshot. Format of date is different.

@AmbrishP7171 as suggested by @Bhavya make a note of date format “dd-MMM-yyyy” . you should use lower case dd and not DD.