Transform language and Dates

I am trying to merge 2 inputs together each one has an activity_date field and i want to have the most recent date to come out of the merge. the code i am using is

date activity_date;
if ($table1.activity_date > $table2.activity_date) {
activity_date = $table1.activity_date;
}
else {
activity_date = $table2.activity_date;
}

the dates in the tables are in yyyy-mm-dd hh:mm:ss format and in the destination table the field is the same. however when i run the graph the date entered in the final table loses the time data and is in yyyy-mm-dd 12:00:00 AM format how cna i fix this

well i found out what it is. MS SQL Server does not like the default date form of Tue Nov 28 16:16:48 EST 2006.

Hi !

Can you try to use print_err() to show what value is actually in activity_date after the if statement ?

It should contain date&time info. Question is how is it defined on the “final table” side - do you mean output data file or database table.

If database table, then the DB data type may not support time information.

If clover data file (text file) then it depends on the metadata - you should have it with format specified and it must contain time - something like this “yyyy-MM-dd HH:mm:ss”