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
r1985r1985 

Error: Illegal assignment from Integer to Date

Hi All,
 
     I declared a variable of date type and when i try to assign a value to that variable its throwing the error "Illegal assignment from Integer to Date". The value assigned is
 
       rp.JobStartDate= 11/20/2008; where JobStartDate is of type date.
 
Kindly clarify.
 
Thanks,
Ram
SetupForceSetupForce
Have you tried something like:

rp.JobStartDate = Date.newInstance(2008,11,20));

Regards
Paul

r1985r1985
 I used date.valueOf(string) function . But the date value is getting added with HH:MM:SS at the end.
How to get them truncated?
                      
             job_Start_Date__c= 2008-11-20 00:00:00 . I need the time to be removed off.
 
Kindly suggest me an idea
Thanks,
Ram
Br1Br1
To show it without the hour you can format the date with the the format() method, is based on java SimpleDateFormat:

http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html

DateTimeVariable.format('EEE, d MMM yyyy') --> have to show : Thu, 6 Oct 2008

You can see all the Date and DateTime methods at the apex documentation:
http://www.salesforce.com/us/developer/docs/apexcode/index.htm

Hope it helps
Br1.




r1985r1985

 

Thank u very much.