Calculate Number of Days between Two Dates in Informix

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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