Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
Question 45 of 83
Free Preview · 83 of 275 · questions 1–83 of 275 are free. Sign up free to sync your progress across devices.
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
A considers user locale. I see some C answers here but it's not correct. String.valueOf(Date) converts a Date to a String, but without considering the user's locale; it is a fixed format.
the correct answer is A. A and C are very close but differ in the following way. A is the date format method- it returns the date as string using the user locale. C is a string method- it returns a string of the date specified in the standard format of YYYY-MM-DD. my locale is english(canada) the format is YYYY-MM-DD so seems that C is correct ans. But here is the catch. when I change my local to French(France) the date format of my local becomes DD/MM/YYYY. In this case String method will not work. Thus A is the ans.
Correct answer is A. https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_date.htm#apex_System_Date_format