.NET All DateTime Patterns

By Jatin Prajapati

In this FAQ we will see how to get all the date time patterns provided by .NET Framework.

Please see the below code example for how to get all the date time patters provided by .NET Framework.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
        string[] monthNames = System.Globalization.DateTimeFormatInfo.CurrentInfo.GetAllDateTimePatterns();
        foreach (string s in monthNames)
             Response.Write(string.Format("{0}<br/>", s));

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Get all date time patters in .NET Framework</title>
    <form id="form1" runat="server">

.NET All DateTime Patterns  (1075 Views)