Skip to main content
Mamatha HL (FPSS) ha fatto una domanda in #Apex
I have a string date '3/26/15' in MM/dd/yy, i want to convert to Date object. But using Date.parse(StringDate) gives me Invalid Date error even with Date.valueOf(StringDate) throws same error.

Please help ASAP.

Thank you in advance

Sachin
1 risposta
  1. 27 mar 2015, 06:19
    Hi Sachin,

    Please check below code ,It will work .

    String str='3/26/15';

    String strr=str.replace('/','-')+'  00:00:00';

    Date dt=Date.valueOf(strr);
0/9000