Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: ari1
  • Order by date
  1. ari1

    Age calculation in DB2

    Dear angiole In DB2 the difference comes in format yymmdd, that's why it must first be divided by 10000 to get eg 12,0512 and then "floored" to 12,0 and finally "integered" to 12, meaning the age of 12. Ari
  2. ari1

    date difference in SQL

    Marc I figured out myself this date -difference thing too. Your examples were right. Your query works, but gives months- between and needs to be divided with 12 and rounded. This is maybe simpler: select integer(floor( (datefield1 - datefield2) / 10000 ) as age ... OR select...
  3. ari1

    Age calculation in DB2

    Ifound a working solution with help from Sathyaram (dBforums): select current date, date_1 , integer( floor( (current date - date_1 ) / 10000 )) as age from table_1. This works now: difference between 1990-06-19 and 2002-06-19 => 12 years, and the difference 1990-06-20 and 2002-06-19 => 11...
  4. ari1

    date difference in SQL

    Thanks, it looks ok, but there is no MONTHS -function, at least not in UDB2 version 7 (NT). The problem is, that difference between 1990-06-19 and 2002-06-19 => 12 years, and the differnece 1990-06-20 and 2002-06-19 => 11 years. No solution in DB2?
  5. ari1

    Age calculation in DB2

    Thank you, but I can't see how this works? Multiply years by 12? The problem is, that difference between 1990-06-19 and 2002-06-19 => 12 years, and the differnece 1990-06-20 and 2002-06-19 => 11 years.
  6. ari1

    date difference in SQL

    In Orcale there is a function MONTHS_BETWEEN and in SQL Server DateDiff which help to calculate age from a birthdate. Is there a similar function in DB2 to get a difference of dates (in months)?
  7. ari1

    Age calculation in DB2

    In Orcale there is a function MONTHS_BETWEEN and in SQL Server DateDiff which help to calculate age from a birthdate. Is there a similar function in DB2 to get a difference of dates (in months)?

Part and Inventory Search

Back
Top