0

I am importing records from Data loader and there is date format in csv is : 27.08.2016 04:40:19 & Salesforce Does not support this format as it has English(United State) locale..

so, i am thinking let's write one apex trigger to check and convert this format to salesforce system format (MM/dd/yyyy)..

is it correct way ?

Error while importing data from data loader is : Unparseable date: "27.08.2016 04:40:19"

I am not sure about below code, please guide me !!

code is :

if(a.Temp_OTT_Change_Date__c != null){
    Datetime OttDate = a.Temp_OTT_Change_Date__c;
    string dateOutput = OttDate.format('MM/dd/yyyy hh:mm:ss');
    a.OTT_Change_Date__c = datetime.valueOf(dateOutput);
}

Thanks in Advance !!

  • Try to directly assign with out using string. – Pavan tej Nov 11 '16 at 7:23
  • but temp_OTT_Change_Date__c is not getting that Date format (27.08.2016)..because it has sfdc date format (mm/dd/yyyy) – Nihar Nov 11 '16 at 7:29
  • I think it is a helpful resource resource for you docs.oracle.com/javase/7/docs/api/java/text/… – Pavan tej Nov 11 '16 at 7:41
0

let Incoming Date d = 27.08.2016 04:40:19
Convert your date to string

    string s = String.valueof(d);
    s = s.replace('.','/');

the new date is in format of 27/08/2016 04:40:19. Now convert this to date.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.