I am trying to navigate the help pages associated with this, and I simply cannot find this simple reference. I want to show the first ten characters from a DateTime (CloseDate on Opportunity):
o.CloseDate.SubString(0,10)
I just want the "2012-11-15" reference pulled out. What am I missing here? :-( Thanks for any help, all.
Attribution to: AMM
Possible Suggestion/Solution #1
String myDate = o.CloseDate.year() + '-' + o.CloseDate.month() + '-' + o.CloseDate.day();
Or:
String myDate = String.valueOf(o.CloseDate).SubString(0,10);
Attribution to: Sergej Utko
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5344