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
suneel.patchipulusu@gmail.comsuneel.patchipulusu@gmail.com 

Compaatetime to date??

Scenario: I am comparing the dates from different Objects

Quote__c.CreatedDate =: clm.Claim_Invoice_Date__c (if these both dates are equla I will do some thing)

 

 

So,Here Quote__c is the custom object  and CreatedDate is the standard field (Normally it is created by) when we access this iin Apex we will get this CreatedDate--------------------   21.02.2013 15:35  here I need to get only Date, I dont ned the time and this date  I am comparing with Claim_Invoice_Date__c( It is an 'Date' datatype)

 

 

PLease could any one give some suggesstions for this

 

Thanks in advance

 

 

 

SamuelDeRyckeSamuelDeRycke

Have you looked at the  DateTime and Date methods ? Everything you need is in there.

 

For instance:

 

testobject__c  tObjOne =  new testobject__c();
tObjOne.datetimefield__c = datetime.newInstance(2013, 2, 22, 6, 9, 6);

testobject__c  tObjTwo =  new testobject__c();
tObjTwo.datefield__c =  date.parse('22/02/2013');


if(tObjTwo.datefield__c.isSameDay(tObjOne.datetimefield__c.date())){
system.debug('We have the same birthday! :D');
}

 

 

 

 

Vinit_KumarVinit_Kumar

You need to create a formula field on that object which would remove the Time from the CreatedDate and then use that Formula Field