-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEx6.cs
More file actions
37 lines (34 loc) · 979 Bytes
/
Copy pathEx6.cs
File metadata and controls
37 lines (34 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HW1
{
public partial class Ex6 : Form
{
public Ex6()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DateTime date= DateTime.Parse(maskedTextBox1.Text);
label2.Text = $"IT IS {Date(date.Day,date.Month,date.Year)}";
}
string Date(int D, int M, int Y)
{
int a, y, m, R;
a = (14 - M) / 12;
y = Y - a;
m = M + 12 * a - 2;
R = 7000 + (D + y + y / 4 - y / 100 + y / 400 + (31 * m) / 12);
string[] S = { "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY" };
return S[R % 7];
}
}
}