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
Sakthi Ganesh RSakthi Ganesh R 

Hi all,

I have written a trigger, like

 Billing_MVA__c Bill = trigger.new[0];
     string sdate = Bill.Billing_cycle_from__c;
     string edate = bill.Billing_cycle_to__c;
        
    string[] stdate = sdate.split('/');
        string[] endate = edate.split('/');

            string sday = stdate[2];
            string smonth = stdate[1];
            string syear = stdate[0];
            date startdate = date.parse(smonth+'/'+sday+'/'+syear);
            system.debug('*************'+startdate);

I got debug log output like 
USER_DEBUG|[21]|DEBUG|*************2014-01-01 00:00:00

But i don't want to like this, I want only date as mm/day/year format. can any one help me?

Thanks in advance
 
Scott HungScott Hung
If you're not picky about the type one way is to:
date startdate = date.parse(smonth+'/'+sday+'/'+syear);
string newst = startdate.format();
system.debug('newst = '+newst);