Monday, February 20, 2012

Nb Months between 2 dates (one in DB2 format)

How can I get the number of months (or years or days...)
between the current_timestamp
an a date in the DB2 format ?
DateDB2 Char(26) = 2000-12-30-12.55.30.123456
DateSQL = GetDate() or Current_Timestampdatediff (mm,convert (datetime , substring(datedb2,1,10)),DateSQL )|||nope,

I've tried that sort of conversion but it seems
that the CONVERT(DateTime,...) function inverts
the month and the day

Convert(DateTime,'2000-12-30') >>> doesn't work !!!
Convert(DateTime,'2000-30-12') >>> works !!!

Is '2000-30-12' a standard English-Format-Date ?|||Convert(DateTime,'2000-12-30') >>> doesn't work !!!
Then try this >>> select Convert(DateTime,'2000-12-30',120)|||Thank you very much Enigma !

No comments:

Post a Comment