Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am at Australia and the time now is 13:00 Feb 1. With the following code:

DateTime thisTime =;
System.debug(thisTime.format('DD/MM/YYYY HH:mm'));

For the 2nd line I got 2016-01-01 03:22:04 which is correct. But for the 3rd line(the format one) I got 32/02/2016 + time. Is that a Salesforce bug? Any known issues or walkarounds?

share|improve this question
I can't follow your example. Today is feb 2nd, but you say 01-01 is correct? Can you include the exact debug outputs, just to be sure? – Guy Feb 1 at 12:11
@Guy Sorry, typo, it should be 01-02 – Lance Shi Feb 1 at 23:02

My fault. It should be dd/MM/YYYY instead of DD/MM/YYYY

share|improve this answer

But did you figure out what D (Capital D) mean?

Here is your answer

enter image description here

For more details

share|improve this answer
Here is a even better list provided in Salesforce doc:… – Lance Shi Feb 1 at 5:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.