hitung masa kerja/umur menggunakan asp.net c#

Standar

#region masabekerja

int lama;
DateTime d = Convert.ToDateTime(txtTanggalStart.Text);

string s = d.ToString(“dd/MM/yyyy”);

// Convert date time in string (s) to DateTime (Todate) data type

DateTime Todate = DateTime.Parse(s, CultureInfo.CreateSpecificCulture(“en-AU”));

// Convert entered date string (TextBox1.Text) to DateTime (givenDate) Data Type

DateTime givenDate = DateTime.Parse(queryPrem.Kary_TglMskKrja.ToString());

// Count total days

double days = Todate.Subtract(givenDate).Days;

// Convert days to year and display into Label.Text

lama = Convert.ToInt32(Math.Floor(days / 365.24219));

#endregion

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s