On the Task's field setup page, the ActivityDate is described as Date/Time but when I try to assign a DateTime variable to it, then I receive this error

t.ActivityDate = DateTime.now() //this line of code created below error

Illegal assignment from Datetime to Date

When I assign a Date, then no error.

t.ActivityDate = Date.today() //This works fine

Salesforce documentation also suggests it is a Date field.

My question is, is this a mistake on part of Salesforce or Bug or am I missing something?

enter image description here

  • looks like this is a bug. I tried in my devbox and got the same error. Commented May 17, 2017 at 20:29

1 Answer 1


It's not a bug, DueDate Datatype itself is 'Date' not Date/Time.enter image description here

  • It seems they fixed it :)
    – abdn
    Commented May 3, 2019 at 11:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .