Calculate Number of Days between Two Dates in Informix

This content 8 years old. Please, read this page keeping its age in mind along with the fact technology changes fast and the information on this page me be outdated, not best practice, or plain wrong.

This is how I calculate the number of days between two dates.

Suppose I have a small table:

Customer
Name
LastLogon
select current year to day - extend(customer.lastlogon, year to day)

You can use MINUTE, HOUR, SECOND as well to get a little more granular.

Speak Your Mind

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.