New answers tagged

1 vote

Change the CreatedDate format in Apex

Yes, look through the Datetime class documentation to see how to use the format() method (the one that takes a formatting string)
user avatar
  • 48.4k
0 votes

String to DateTime Conversion

Ideally, you'll want to use Datetime.valueOf(stringDate) or Datetime.valueOfGmt(stringDate) where stringDate is of the format yyyy-MM-dd HH:mm:ss If you do not have control over the creation of the ...
user avatar
  • 760
0 votes

String to DateTime Conversion

The first thing that I noticed is a missing comma after the date value, so the string date value should be '10/14/2011, 11:46:00 AM' You might also need to enable the ICU locale formats, please visit ...
user avatar
0 votes

How to set a Date in apex test class?

Another option is using system.today().addDays(10) acc.effectiveDate__c = System.today().addDays(10);
user avatar

Top 50 recent answers are included