Forum Discussion
nmrao
9 years agoCommunity Hero
Here is the script:
https://github.com/nmrao/groovyScripts/blob/master/date/DateStringToMillis.groovy
Quick online demo:
https://ideone.com/T3oyru
https://github.com/nmrao/groovyScripts/blob/master/date/DateStringToMillis.groovy
Quick online demo:
https://ideone.com/T3oyru
karelkremel
9 years agoOccasional Contributor
for some reason i'm getting an error about unparseable date when i read it from test case propriety
sample value: 1504872000000
def dateFormat = 'yyyy-MM-dd HH:mm:ssZ'
def start_date_raw = testRunner.testCase.getPropertyValue("start_date").substring(0,10)
def end_date_raw = testRunner.testCase.getPropertyValue("end_date").substring(0,10)
def start_date_unix = Date.parse(dateFormat, start_date_raw).time
def end_date_unix = Date.parse(dateFormat, end_date_raw).time
testRunner.testCase.setPropertyValue( "start_date", start_date_unix )
testRunner.testCase.setPropertyValue( "end_date", end_date_unix )