how to find retirment date by birth date...

on Jul 30, 2022 06:06 AM

how to find employee retirment date when we enter employee's date of birth.

suppose any employee have 58 year working year and when we enter date of birth in textbox then employee's retirment month last date should be display in next textbox....

how to do this task...?

kindly help.....

Download FREE API for Word, Excel and PDF in ASP.Net: Download
Results 1 - 5 of 11
on Jul 30, 2022 06:09 AM

Hi Bhavesh23,

I am checking your question and I am get back to you in 2 hours.

on Jul 30, 2022 08:03 AM
on Jul 30, 2022 08:11 AM

Hi Bhavesh23,

You need to use AddYears method of DateTime class for your Retirment Date and for last day of month use DaysInMonth method.

Please refer below sample.


        <td><asp:TextBox ID="txtBirthDate" runat="server"></asp:TextBox></td>
        <td>Retirment Date:</td>
        <td><asp:TextBox ID="txtRetirmentDate" runat="server"></asp:TextBox></td>
<br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="OnSubmit" />



protected void OnSubmit(object sender, EventArgs e)
    DateTime dateTime = Convert.ToDateTime(txtBirthDate.Text.Trim());
    txtRetirmentDate.Text = this.GetLastDayOfMonth(dateTime.AddYears(58)).ToString("dd/MM/yyyy");

private DateTime GetLastDayOfMonth(DateTime dateTime)
    return new DateTime(dateTime.Year, dateTime.Month, DateTime.DaysInMonth(dateTime.Year, dateTime.Month));


Protected Sub OnSubmit(ByVal sender As Object, ByVal e As EventArgs)
    Dim dateTime As DateTime = Convert.ToDateTime(txtBirthDate.Text.Trim())
    txtRetirmentDate.Text = Me.GetLastDayOfMonth(dateTime.AddYears(58)).ToString("dd/MM/yyyy")
End Sub

Private Function GetLastDayOfMonth(ByVal dateTime As DateTime) As DateTime
    Return New DateTime(dateTime.Year, dateTime.Month, DateTime.DaysInMonth(dateTime.Year, dateTime.Month))
End Function


on Aug 02, 2022 12:18 AM
on Aug 02, 2022 12:35 AM

can we use this method in vb6.0 project.?

how to implement this in vb6.0 ?

on Aug 02, 2022 08:09 AM

Hi Bhavesh23,

For Visual Basic 6.0 use DateAdd function.


on Aug 03, 2022 12:34 AM

i code as below but it occur error having not much knowledge in vb6.0

kindly help me to resolve this

i want to display retirenment date into another textbox by date of birth. 

Automation type is not supported in visual basic

Dim dateTime As dateTime
Dim NextYear As Date
Dim str As String

dateTime = convert.ToDateTime(txtdob.Text)
NextYear = DateAdd(DateInterval.Year, 58, dateTime)
str = Format(NextYear, "dd/MM/yyyy")


Results 1 - 5 of 11