Here you see how to change Arabic Calendar Date to English Calendar Date in Windows Form C#.
Step 1: Go to the VS 2010 Menu and select "File" -> "New" -> "Project.." then select Visual C# -> Window Forms Application and create the Windows Forms application.
Figure 1
Step 2: Then we will select the make Form Fig 2 using Textbox, Label, Button figure 2
Figure 2 Step 3: Then go to the Form 1 file and write this code to convert to Arabic date to English date.Double click BUTTON write this code
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Threading;
- using System.Globalization;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- CultureInfo arCI = new CultureInfo("ar-SA");
- string hijri = textBox1.Text + " 00:00:00";
-
- string ar = tempDate.ToString(new CultureInfo("ar-SA"));
- GregorianCalendar enCalendar = new GregorianCalendar();
- int year = enCalendar.GetYear(tempDate);
- int month = enCalendar.GetMonth(tempDate);
- int day = enCalendar.GetDayOfMonth(tempDate);
- textBox2.Text = (string.Format("{0}/{1}/{2}", day, month, year));
- }
- }
- }
Figure 3
Step 4: Then we will Enter the valid arabic date (hijiri date) in the format of "DD/MM/YYYY" if u want change the format u can include format also.
Figure 4
Output
Figure 5
Summary
In this article, we discussed discuss how to convert arabic date to english date in Windows Forms. After that, we discussed how to use its various properties and methods to build real gulf world applications.