473,767 Members | 2,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calculate age from date of birth

TJS
what namespaces are required so I can do a simple calculate age from date of
birth ?

Nov 18 '05 #1
8 8237
System.DateTime

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"TJS" <no****@here.co m> wrote in message
news:uP******** ******@TK2MSFTN GP09.phx.gbl...
what namespaces are required so I can do a simple calculate age from date of birth ?

Nov 18 '05 #2
In VB you can just use the DateDiff function, in C# use the TimeSpan
structure.

"TJS" <no****@here.co m> wrote in message
news:uP******** ******@TK2MSFTN GP09.phx.gbl...
what namespaces are required so I can do a simple calculate age from date of birth ?

Nov 18 '05 #3
TJS
I added

"Imports System.DateTime " to my vb file, but keep getting error on
"datediff" when I try to compile ?


"Chris Bower" <ch***********@ SPAMunionfedban k.com> wrote in message
news:ua******** ******@TK2MSFTN GP12.phx.gbl...
In VB you can just use the DateDiff function, in C# use the TimeSpan
structure.

"TJS" <no****@here.co m> wrote in message
news:uP******** ******@TK2MSFTN GP09.phx.gbl...
what namespaces are required so I can do a simple calculate age from
date of
birth ?


Nov 18 '05 #4
TJS
I added

"Imports System.DateTime " to my vb file, but keep getting error on
"datediff" when I try to compile ?
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:uu******** ******@TK2MSFTN GP09.phx.gbl...
System.DateTime

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"TJS" <no****@here.co m> wrote in message
news:uP******** ******@TK2MSFTN GP09.phx.gbl...
what namespaces are required so I can do a simple calculate age from
date of
birth ?


Nov 18 '05 #5
Oh and System.DateTime is a structure, not a namespace.

"TJS" <no****@here.co m> wrote in message
news:uy******** *****@tk2msftng p13.phx.gbl...
I added

"Imports System.DateTime " to my vb file, but keep getting error on
"datediff" when I try to compile ?


"Chris Bower" <ch***********@ SPAMunionfedban k.com> wrote in message
news:ua******** ******@TK2MSFTN GP12.phx.gbl...
In VB you can just use the DateDiff function, in C# use the TimeSpan
structure.

"TJS" <no****@here.co m> wrote in message
news:uP******** ******@TK2MSFTN GP09.phx.gbl...
what namespaces are required so I can do a simple calculate age from

date
of
birth ?



Nov 18 '05 #6
DateDiff is a function in the Microsoft.Visua lBasic namespace.

"TJS" <no****@here.co m> wrote in message
news:uy******** *****@tk2msftng p13.phx.gbl...
I added

"Imports System.DateTime " to my vb file, but keep getting error on
"datediff" when I try to compile ?


"Chris Bower" <ch***********@ SPAMunionfedban k.com> wrote in message
news:ua******** ******@TK2MSFTN GP12.phx.gbl...
In VB you can just use the DateDiff function, in C# use the TimeSpan
structure.

"TJS" <no****@here.co m> wrote in message
news:uP******** ******@TK2MSFTN GP09.phx.gbl...
what namespaces are required so I can do a simple calculate age from

date
of
birth ?



Nov 18 '05 #7
TJS
that worked

thanks
"Chris Bower" <ch***********@ SPAMunionfedban k.com> wrote in message
news:OT******** ******@TK2MSFTN GP12.phx.gbl...
DateDiff is a function in the Microsoft.Visua lBasic namespace.

"TJS" <no****@here.co m> wrote in message
news:uy******** *****@tk2msftng p13.phx.gbl...
I added

"Imports System.DateTime " to my vb file, but keep getting error on
"datediff" when I try to compile ?


"Chris Bower" <ch***********@ SPAMunionfedban k.com> wrote in message
news:ua******** ******@TK2MSFTN GP12.phx.gbl...
In VB you can just use the DateDiff function, in C# use the TimeSpan
structure.

"TJS" <no****@here.co m> wrote in message
news:uP******** ******@TK2MSFTN GP09.phx.gbl...
> what namespaces are required so I can do a simple calculate age from

date
of
> birth ?
>
>
>



Nov 18 '05 #8
And the error was?...

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"TJS" <no****@here.co m> wrote in message
news:uy******** *****@tk2msftng p13.phx.gbl...
I added

"Imports System.DateTime " to my vb file, but keep getting error on
"datediff" when I try to compile ?


"Chris Bower" <ch***********@ SPAMunionfedban k.com> wrote in message
news:ua******** ******@TK2MSFTN GP12.phx.gbl...
In VB you can just use the DateDiff function, in C# use the TimeSpan
structure.

"TJS" <no****@here.co m> wrote in message
news:uP******** ******@TK2MSFTN GP09.phx.gbl...
what namespaces are required so I can do a simple calculate age from

date
of
birth ?



Nov 18 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
11861
by: Gav | last post by:
I have a database with date of births stored dd/mm/yyyy (english dating system) and =date() returns a date in the same format in my server. how do i find the persons age using these two pieces of date. thanks gavin
26
4413
by: Frank | last post by:
For my website i would like to display the age of my son in years, months, days and hours. For now i manage to get a result for totals. Like the total number of days. This is the beginning: starttime = Date.parse("Aug 10,2003, 07:07") sdt = new Date(starttime)
16
2116
by: KL | last post by:
I am working on a problem and desperately need help! I need to prompt a user for the numerical month of birth, day of birth and year of birth and store it in varialbes and the use the variables to build a date object. Then print the resulting date object, in it's full form. on the screen using document.write. This IS for school and I think I am starting out right, but can't quite seem to grasp what I am doing wrong, or where to go from...
3
5588
by: Alan Mews | last post by:
Hi All Being a Newbie and tried very hard to get my Database (Access) to calculate the age of a person, in years, from the Date of Birth. The Fields are: DateofBirth minus Today's Date =Age, in years, of person. Any help will be much appreciated.
4
9340
by: Jan Szymczuk | last post by:
I'm creating an MS Access 2000 database where I have a number of people entered using simple basic fields, Surname: SMITH Forenames: John DoB: 09/09/1958 Age: (this needs to be automated to show years e.g. 46) I am trying to get the age to be automatically shown after a persons DoB (date of birth) is entered into the DoB field. I have tried using this formula in the Control Source of the Age field...
7
15505
by: Adrian | last post by:
I hit on this problem converting a VB.NET insurance application to C#. Age next birthday calculated from date of birth is often needed in insurance premium calculations. Originally done using DateDiff in VB.NET which is only available in C# if you don't mind linking in Microsoft.VisualBasic.dll to your C# application. I wanted to avoid this so set about a pure C# solution which uses a combination of TimeSpan in whole days and the...
8
17579
by: helpless | last post by:
Access 2003 - I am trying to calculate the difference between a specific date 5/1/2007 (not in a data field) and other dates that ARE in a field called Birth Date. I am trying to have it fill into an Age field (in years only) by comparing the date above to the Birth Date field. I have tried this and it doesn't work: =DateDiff("yyyy", , ) Displays the variance in years between the values of the Birthday1 and Birthday2 fields. (from Access...
2
3372
by: AccessHunter | last post by:
Hi, I have a table (Admittance) that has birth dates of all cases admitted, fields being (Case Number and Birth Date). I also have a form that asks the user to select a year and click the 'Find' button to get a list of all the Cases that were 18 yrs old on the year selected. The way I want to do this is, invoke an event on 'Find' button click that will accept the year selected and looping throught the entire table, do the following,...
3
3412
by: jamieharrop | last post by:
Afternoon all, I've been battling with this all day today and my brain is now pretty much fried. I have one table that lists several details about my customers (name, address, phone, date of birth etc). I want to create a query that will allow me to enter a start date and an end date and will then display the customers who have birthdays within those two dates. I know I can do this using:
0
9571
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9838
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.