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
jcressardjcressard 

Date in an apex Code

Hi,

 

I try to use a Date in an apex code and i write it this way :

 

Date myDate;

 

But i get this error :

 

Error: Compilation Error : unexpected token: 'Date' at line 69 column 12 

 

Any Idea?

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
jcressardjcressard

With your post, i've find my error, it's not the ";" missing, but a bad location of the Date myDate; in the code...

 

I had 

 

 

public LIST<Opportunity> listeCom
        {
      Date myDate;
            get{

 

 

And declaration must be in the get and not out !

 

Thanks !

All Answers

_Prasu__Prasu_

I guess Error might be because of missing ";" on line number 68

bob_buzzardbob_buzzard

There's a number of reasons why you might receive this error - can you post the code surrounding it?

jcressardjcressard

With your post, i've find my error, it's not the ";" missing, but a bad location of the Date myDate; in the code...

 

I had 

 

 

public LIST<Opportunity> listeCom
        {
      Date myDate;
            get{

 

 

And declaration must be in the get and not out !

 

Thanks !

This was selected as the best answer