technomark.in
Hot News

$(this) Selector And Children / Find In jQuery

Detect An Undefined Object Property In JavaScript

Rotate And Save Video Using VLC Media Player

Capitalize The First Letter Of String In JavaScript

Convert Any Files To Any Format Using VLC Media Player

Asp.Net AngularJS WCF IIS
DataBase Jquery Bikes Random
HomeContact Us Watch Our YouTube Channel ..........Blog Spot..........

Technomark.in

How To Logout From All Devices In Skype

Technomark.in

How To Embed Google Map In Your Code

Technomark.in

How To Install IIS (Internet Information Services) On Windows

Technomark.in

Enable Directory Browsing In IIS

View All


Calculate Someone's Age Based On Birthday In Asp.Net (C#)


How To Calculate Someone's Age Based On Birthday

> Here we consider how to Calculate Age From Birthday.
> For that we have to compare the Birth Date with respect to the Current Date.
> Suppose One person's Birthday is on 12/2/1998.
> And we wants to calculate the age of this person.
> First of all, get the Year of the Current date - Current Year.
> Second get the year of the Birth date. - Birth Year.
> Then just subtract the Current Year from Birth Year.
> Assign the difference to an integer variable age.
> Now we can do the following comparison for getting the exact age.

if (birthDate > todayDate.AddYears(-age))


> After Comparison, if birthdate is greater, then subtract one from the current age.
> The full code is as follows.

DateTime birthDate = Convert.ToDateTime("12/2/1998");
DateTime todayDate = DateTime.Today;
int age = todayDate.Year - birthDate.Year;
if (birthDate > todayDate.AddYears(-age))
age--;



Calculate Someone's Age Based On Birthday In Asp Net, How To Calculate Someone's Age Based On Birthday In Asp Net, Calculate Age Based On Birthday, How To Calculate Age Based On Birthday, Asp.Net, C#, Asp.Net MVC, PHP, HTML

Watch Video of this Content on Video Streaming

Post Your Comment

Name *


Email *


Comment * Please provide all three fields for posting Comment




Technomark.in

Book Train Tickets on IRCTC Quickly During Tatkal Period

Technomark.in

Before You Copy Any Image From Internet

View All

Privacy StatementDisclaimerSitemap