parsing - Convert use Date.parser() in groovy Extra minute -
in function exist 2 away convert celldatevalue in date, first use string (my problem one) , second use double.
if (celldatevalue ==~ /[0-9]{2}\\/[0-9]{2}\\/[0-9]{4}/){ return date.parse('dd/mm/yyyy', celldatevalue) } else { return celldatevalue ? dateutil.getjavadate(celldatevalue.todouble()) : null }
input: cellvalue
equals 01/01/2016
output: 2016-01-01t00:01:00.000-0200
in output exist 1 minute more, create problem if compare other dates
my solution:
replace date.parse('dd/mm/yyyy', celldatevalue)
date.parse('dd/mm/yyyy hh:mm', celldatevalue + ' 00:00')
that away ?
you need change:
'dd/mm/yyyy'
to
'dd/mm/yyyy'
you're parsing second 01
minutes, mm
months
ie:
return date.parse('dd/mm/yyyy', celldatevalue)
Comments
Post a Comment