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
NishanNishan 

Help with parsing date to string

Hi Everyone,

                      I used the function valueOf as following

Date date1 = Date.Today();
String abc = valueOf(date1);

 But I get the following error

 

Error: Compile Error: Method does not exist or incorrect signature: valueOf(Date) at line 10 column 28.

 

                          Can someone point me the error. I checked the syntax in the salesforce system calls list and it is the same as the one I used.

Best Answer chosen by Admin (Salesforce Developers) 
souvik9086souvik9086

If you want to parse to string then do it like this

 

Date date1 = Date.Today();
String abc = String.valueOf(date1);

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

 

All Answers

souvik9086souvik9086

If you want to parse to string then do it like this

 

Date date1 = Date.Today();
String abc = String.valueOf(date1);

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

 

This was selected as the best answer
NishanNishan

Hi souvik,

                 Thanks for the solution.