SIGN UP MEMBER LOGIN:    
ARTICLE

System Date Time Check Format

Posted by Mostafa Belal Articles | Current Affairs October 18, 2006
This program executes the system date time format. Is it in dd/mmm/yyyy or other format and the which cultuerInfo is the system running on.
Reader Level:

This program executes the system date time format. Is it in dd/mmm/yyyy or other format and the which cultuerInfo is the system running on.

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Globalization;

using System.Windows.Forms;

 

namespace SystemDateTimeCheck

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

            // Get the Current System culture.

            CultureInfo ci = CultureInfo.CurrentCulture;

            DateTimeFormatInfo dtfi = ci.DateTimeFormat;

 

            string[] SystemDateTimePatterns = new string[250];

            int i = 0;

            foreach (string name in dtfi.GetAllDateTimePatterns('d'))

            {

                SystemDateTimePatterns[i] = name;

                i++;

            }

 

            string[] myDateTimeFormat = { "dd-MMM-yy", "dd-MMM-yyyy" };

            if (myDateTimeFormat[0].Equals(SystemDateTimePatterns[0]) || myDateTimeFormat[1].Equals(SystemDateTimePatterns[0]))

                MessageBox.Show("Your System DateTime Format " + SystemDateTimePatterns[0] + " is OK");

            else

                MessageBox.Show("Your System DateTime Format is: " + SystemDateTimePatterns[0] + "\n" + "Required DateTime Format: dd-MMM-yy Or dd-MMM-yyyy");

        }

    }

}

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Team Foundation Server Hosting
Become a Sponsor