Click to See Complete Forum and Search --> : formating date


moiseszaragoza
02-09-2009, 02:35 PM
I have a simple question to ask.

i am trying to format a date but i get "02/09/2009"
and i want "Feb/09/2009"

how do i do this
Thanks



Partial Class conditions
Inherits System.Web.UI.Page

Public myDate As Date
Public strDate As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
myDate = Date.Now
strDate = Format(myDate, "mm/dd/yyyy")
End Sub
End Class

ryanbutler
02-09-2009, 05:59 PM
Look into the DateTime.Now classes, specifically the ToString methods within those. Just Google, DateTime .NET. There are tons of them, don't remember all of them off hand.

tattooedscorpdc
02-16-2009, 04:16 PM
Try: Format(myDate, "mmm/dd/yyyy")... notice there are three M in the month indicator of the string as opposed to 2 :-)

Larry D
MS Architect Evangelist

moiseszaragoza
02-17-2009, 09:13 AM
i find this to be strange.

when i use

myDate = Date.Now
// #2/17/2009 9:10:55 AM#
strDate = Format(myDate, "mm/dd/yyyy")
//07/17/2009


i dont know why it outputs 07/17/2009 and not 02/17/2009

allso when i try the MMM it outputs

myDate = Date.Now
// #2/17/2009 9:13:04 AM#
strDate = Format(myDate, "mm/dd/yyyy")
//12/17/2009