+ Start a Discussion
dev_smiledev_smile 

Truncate timestamp from date Instance

How to truncate the timestamp from the date object so that the return type is again a valid date which has to be passed to a query to get the result from database.Since in database it is stored without timestamp.

Arvind1Arvind1

You can try  date.valueof(datetime field)

 

Thanks

Arvind

sforce2009sforce2009

Datetime dt = yourdatetime;

Date dateval = date.newInstance(dt.year(), dt.month(), dt.day());

 

I think this should work