private void Form1_Load(object sender, EventArgs e)
{
// Creating a Global culture specific to our application.
System.Globalization.CultureInfo cultureInfo =new System.Globalization.CultureInfo("en-US");
// Creating the DateTime Information specific to our application.
System.Globalization.DateTimeFormatInfo dateTimeInfo =
new System.Globalization.DateTimeFormatInfo();
// Defining various date and time formats.
dateTimeInfo.DateSeparator = "/";
dateTimeInfo.LongDatePattern = "dd-MMM-yyyy";
dateTimeInfo.ShortDatePattern = "dd/MM/yyyy";
dateTimeInfo.LongTimePattern = "hh:mm:ss tt";
dateTimeInfo.ShortTimePattern = "hh:mm tt";
// Setting application wide date time format.
cultureInfo.DateTimeFormat = dateTimeInfo;
// Assigning our custom Culture to the application.
Application.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
label1.Text = DateTime.ParseExact(dateTimePicker1.Value.Date.ToString("dd/MM/yyyy"), "dd/MM/yyyy" ,new CultureInfo("en-US"), DateTimeStyles.None).ToString();
string dt = DateTime.ParseExact(dateTimePicker1.Value.Date.ToString("dd/MM/yyyy"), "dd/MM/yyyy", new CultureInfo("en-US"), DateTimeStyles.None).ToString("MM/dd/yyyy");
}
{
// Creating a Global culture specific to our application.
System.Globalization.CultureInfo cultureInfo =new System.Globalization.CultureInfo("en-US");
// Creating the DateTime Information specific to our application.
System.Globalization.DateTimeFormatInfo dateTimeInfo =
new System.Globalization.DateTimeFormatInfo();
// Defining various date and time formats.
dateTimeInfo.DateSeparator = "/";
dateTimeInfo.LongDatePattern = "dd-MMM-yyyy";
dateTimeInfo.ShortDatePattern = "dd/MM/yyyy";
dateTimeInfo.LongTimePattern = "hh:mm:ss tt";
dateTimeInfo.ShortTimePattern = "hh:mm tt";
// Setting application wide date time format.
cultureInfo.DateTimeFormat = dateTimeInfo;
// Assigning our custom Culture to the application.
Application.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
label1.Text = DateTime.ParseExact(dateTimePicker1.Value.Date.ToString("dd/MM/yyyy"), "dd/MM/yyyy" ,new CultureInfo("en-US"), DateTimeStyles.None).ToString();
string dt = DateTime.ParseExact(dateTimePicker1.Value.Date.ToString("dd/MM/yyyy"), "dd/MM/yyyy", new CultureInfo("en-US"), DateTimeStyles.None).ToString("MM/dd/yyyy");
}
psc jobs
ReplyDelete