Official Google Webmaster Central Blog

Wednesday, February 13, 2008

Date Format - Convert Date Format

1 . Convert Date Format in Asp.Net ( Vb.Net )

Example :

Current date format : 2/22/2008 or 2/22/2008 12:00:00
After converting date format : 22-Feb-2008

Solution :

Dim datformat as String
lblTicketDate.Text = datformat.Format("{0:dd-MMM-yyyy}", dsticketdetail.Tables(0).Rows(0)("dTicketDate"))

2. Convert Date Format in Asp.Net

Example :

Current Date Format : 22-Feb-2008
After converting date format : 2/22/2008

Solution :

Dim dFromOrderDate as String
dFromOrderDate = Convert.ToDateTime(txtFromOrdDate.Text).ToShortDateString()

No comments: