You need to sign in to do that
Don't have an account?

Dispalying date only
I am trying to concatentate a text field with a date without including the time and am getting an error: Method does not exist or incorrect signature: [Date].format(String)
Date NewDate = Camp.Startdate;
// Line below gives CampName2013-12-02 00:00:00
NewCamp1.Name = camp.name + NewDate;
// Line below gives error: Method does not exist or incorrect signature: [Date].format(String)
NewCamp1.Name = camp.name + NewDate.format('MM/dd/yyyy');
What am I doing wrong?
Thanks, Michele
Hi,
If you only want to remove time from date than you can simply do this
//Line below give CampName2013-12-07
NewCamp1.Name = camp.name + String.valueOf(NewDate);
Or if you want format method than use dateTime
// Line below give CampName07/12/2013
NewCamp1.Name = camp.name + NewDate.format();
Or for DateTime you can format
DateTime NewDate = System.now();
// Line below give CampName12/07/2013
NewCamp1.Name = camp.name + NewDate.format('MM/dd/yyyy');
Thanks
Hit the Kudos button (star) and Mark as solution if it post helps you