You need to sign in to do that
Don't have an account?
Yogesh Biyani
Datetime.format unexpected behavior
I tried the following today in apex anonymous window and I see an unexpected behavior
System.debug(Datetime.now()); System.debug(Datetime.now().format('YYYY-MM-DD'));Why id the DD 84 when I use System.debug(Datetime.now().format('YYYY-MM-DD'))?
13:09:14.1 (2508337)|USER_DEBUG|[1]|DEBUG|2020-03-24 19:09:14 13:09:14.1 (2587013)|USER_DEBUG|[2]|DEBUG|2020-03-84
I think your query is answered in this blog,
https://salesforce.stackexchange.com/questions/103436/datetime-format-unexpected-behavior
Check it once.
Thanks.
All Answers
I tried the format listed in the following document to display only date value https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_date.htm and It is showing correct value for me
date myDate = date.newInstance(2020, 3, 24);
String dayString = myDate.format();
System.debug('format' + dayString);
You can raise a case with support if you see any odd behavior. Thanks
Anudeep
I think your query is answered in this blog,
https://salesforce.stackexchange.com/questions/103436/datetime-format-unexpected-behavior
Check it once.
Thanks.
Thanks for looking into this. However, I am using the DateTime class.
Also, I see that System.debug(Datetime.now().format('YYYY-MM-dd')); gives the desired result. Notice I am using dd vs DD in the format string.
Yogesh
date myDate = date.newInstance(2020, 3, 24);
String dayString = myDate.format();
System.debug('format' + dayString);
And Also Follow This
https://salesforce.stackexchange.com/questions/103436/datetime-format-unexpected-behavior
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Download Movies From Filmyzilla (https://filmyzillatv.com)
Download Movies IN HD
(https://filmyzillatv.com)