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
nisha c onisha c o 

date from created date

hi,

 

how do i access only date from created date in a trigger?

 

thank you,

nisha

hitesh90hitesh90

Hi nisha,

 

Here is the example how to access only date from created date.

 

Code:

Contact c = [select id,createddate from contact where id = '0039000000NnjE6'];
datetime dt = c.createddate;
date createddt = dt.date();

 

Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator

Shiva Ramesh @ xcdhrShiva Ramesh @ xcdhr

Hi Nisha

 

For trigger

 

Date Fieldvalue1 = objvariable.CreatedDate.date();

 

For formula field Datetime conversion to Date. You can use:

 

 DATEVALUE(expression)