Convert String to DataTime in Workflow JScript

Have a data field I extract from a SQL DB, unfortently it is in string format
Format “yyyy-MM-dd HH:mm:ss”

I have to check if the date is higher than another date i a JScript in the workflow, the other date is in datetime format.

Any hints on how to get it to work ?

My Script:
var PDFCenter_FileDate = Watch.GetVariable(“LastDownLoadPDFCenter”); // Format “yyyy-MM-dd HH:mm:ss”
var PDFFile_UpdateDate = Watch.GetVariable(“LastDownLoadPDFFile”); // Format “yyyy/MM/dd HH:mm:ss”

PDFCenter_FileDate = PDFCenter_FileDate.date(PDFCenter_FileDate, “yyyy-MM-dd HH:mm:ss”);

if (PDFCenter_FileDater > PDFFile_UpdateDate){
Script.ReturnValue = 1; //SCRIPT TRUE - File needs update
}
else {
Script.ReturnValue = 0; //SCRIPT FALSE - No file update needed
}

It says Error on the if line, where I convert it to datetime.

Use something like this to convert your values to dates:

var PDFCenter_FileDate = new Date( Watch.GetVariable(“LastDownLoadPDFCenter”).replace(/-/i,"/"));

Once both dates are converted to actual timestamps, then you can compare them.