Trying to convert DAteTime field in local user time zone with following code but get an error:
Compile Error: Method does not exist or incorrect signature: [Date].format(String, String)
TimeZone tz = UserInfo.getTimeZone();
List<Task> allTasks = [Select id, ActivityDate, Description, Subject from Task where Id IN :taskIds];
for (Task t : allTasks)
{
DateTime dt = t.ActivityDate.format('M/d/yyyy hh:mm a',tz.getId());
}
Please help. Thanks in advance
DateTime.format()
method always return string not DateTime.. Yes also format is method of dateTime not date