I have string in below format
0030k000002HsSaAAK#2009-06-21 00:00:00,0030k000002HpvTAAS#2003-05-08 00:00:00,0030k000002uxiyAAA#2011-06-29 00:00:00,
I have to separate out only dates from this like
2009-06-21
, 2003-05-08
and 2011-06-29
and then I have to do comparison of the dates and find out the latest date.
Can anyone help me in splitting this.
Here's my current code:
set<String> dateSet = new set<String>();
String s='0030k000002HsSaAAK#2009-06-21 00:00:00,0030k000002HpvTAAS#2003-05-08 00:00:00,0030k000002uxiyAAA#2011-06-29 00:00:00,';
List<String> splitstr = new List<String>();
splitstr = s.split('[,]{1}[\\s]?');
system.debug('splitstr'+splitstr[0]);