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
yogesh.rankawatyogesh.rankawat 

How can assign a Datetime objet to Date object ?

How can assign a Datetime objet to Date object ?

Datetime dt = System.now();
Date d = Date.valueOf(dt);

This code is not working ........
micwamicwa
This works but maybe not the nicest way:
Code:
Datetime dt = System.now();
Date d = Date.newInstance(dt.year(), dt.month(), dt.day());