FavoriteMamatha HL (FPSS) asked in #ApexMar 27, 2015, 6:12 AMString to date conversion?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 advanceSachin1 answerSortSort by DateSort by Most HelpfulSort by DateManoj Kumar Jena (GE Healthcare)Mar 27, 2015, 6:19 AMHi 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);Add a commentWrite an answer...BoldItalicUnderlineStrikethroughBulleted ListNumbered ListAdd linkCode blockInsert imageAttach filesLink URLCancelSave0/9000Reply
Manoj Kumar Jena (GE Healthcare)Mar 27, 2015, 6:19 AMHi 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);