function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jdajda 

Date becomes datetime

I have a simple date declared using following way.

private date startOfTheWeek.

But when I try to print it out it also prints the time as 00:00:00. If the problem is only printing then I can work it around with format(). But the real problem is I have to use this value in SOQL to compare against a date field. Due to this problem the records are not getting matched even if they belong to the same date. Could someone please help?

Imran MohammedImran Mohammed

Appears you are using apex:outputText field to print the date.

If you use apex:outputField tag and bind it with the Custom Object instance, then you will not face this issue.

 

In the SOQL query, what is the type of the compared field?

Is it of Datetime format?