field DATA1 have 12-dic-78 (the field have shorth date property)
field ANNI (integer)
i need to update ANNI with difference from DATA1-current date (now), how to?
in my case the result in ANNI is 36
2014-1978=36
with a sql query, please
DIFFERENCE from date and return age
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: DIFFERENCE from date and return age
UPDATE MyTable SET ANNI = Year(Date())-Year(DATA1)
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
Re: DIFFERENCE from date and return age
OPS...HansV wrote:UPDATE MyTable SET ANNI = Year(Date())-Year(DATA1)
but if i have 12-12-29
naturally the account is born in 1929!
the query return negative number or wrong result
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: DIFFERENCE from date and return age
That depends on a Windows setting - see XL2000: Gestione degli anni a due cifre in Microsoft Excel (it applies to other applications too). By default, two-digit years 00 - 29 are interpreted as 2000 - 2029, and two-digit years 30 - 99 are interpreted as 1930 - 1999.
Best wishes,
Hans
Hans