ASP.Net VB Format Date according to your requirement can be customized using ToString function. You can pass the format of Date to VB ToString function to display the Date in the specified format. There are alphabetical symbols to represent the formats for Date parts such as M for month, d for day and y for year. You can adjust the sequence of Date parts using these terms to format Date. Following are different types of ASP.Net VB format Date patterns that can be used in Asp.Net web pages to display the date:
Above Date Formats can be used to display the Date in different ways.
You can pass the above discussed Date Formats to the ToString function:
DateTime.Now.ToString("MM/dd/yyyy")
Similarly you can pass different format combinations for Date.
' Displays short date format MM/dd/yyyy
Response.Write("<br>")
' Displays short date format MM-dd-yyyy
' Displays short date format dd-MM-yyyy
' Displays short date format dd/MM/yyyy
' Displays long date format MMM dd, yyyy
' MMM shows first three letters of month name
' Displays long date format dddd, MMM dd, yyyy
' dddd shows full name of the day
' Displays date format MMMM dd, yyyy
' MMMM shows full name of the month
Response.Write(DateTime.Now.ToString("MMMM dd, yyyy"))
Output:
07/22/2008 07-22-2008 22-07-2008 22/07/2008 Jul 22, 2008 Tuesday, Jul 22, 2008 July 22, 2008
Be the first to rate this post
Tags: asp.net 2.0, asp.net vb format date, vb datetime, vb tostring function, asp.net datetime, vb current datetime, asp.net datetime format, free source code, c# datetime, asp.net vb datetime, asp.net c# datetime, asp.net vb tostring function, asp.net format date
10/11/2008 3:39:09 AM