function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bob NagyBob Nagy 

Obvious SF bug or am I missing something - see for yourself

A simple format call on a datetime is return the wrong value.  A year that should be 2015 is coming back 2016.  Am I missing something?

Here is a simple 3 line code example that demonstrates the problem:
 
// Create a DateTime of December 27, 2015
datetime dtTemp = DateTime.newInstance(2015, 12, 27, 0,0,0);
// Format that Date Time - Should Be; December 27, 2015
String sFormatedDate = dtTemp.format('MMMM d, YYYY');
system.debug('++++++++++++++++++Formatted Date  = ' + sFormatedDate);
// Actual is coming back December 27,2016

 
Best Answer chosen by Bob Nagy
SivarajanSivarajan
You should mention the year literal in lower case as yyyy.

Please mark it as best answer if it helps you to resolve.

 

All Answers

SivarajanSivarajan
You should mention the year literal in lower case as yyyy.

Please mark it as best answer if it helps you to resolve.

 
This was selected as the best answer
Bob NagyBob Nagy
That is absolutly it!!!!!!   Thank you so much.