Time Date Difference- Workflow

Time Date Difference- Workflow

I would like to ask if this conditional statement is possible:

var1= 2018-05-11 16:24:26
var2= 2018-05-11 16:51:14

if(var1.toTime() >= var2.toTime()){
 // sample codes here 
}

I'm trying to compare two time dates, but it isnt working.
I've tried researching but there aren't many documentation about this query
What can be wrong?

Thank you