This is MuchBetterLongDateTime Function which returns a String value of the given datetime object.
It also automatically adds a post fix of st to date.
Public Shared Function MuchBetterLongDateFormat(ByVal [date] As DateTime) As String
Dim day As Integer = [date].Day Dim post As String Select Case day Case 1, 21, 31 post = " st ," Case 2, 22 post = " nd ," Case 3, 23 post = " rd " Case Else post = " th ," End Select Dim month As String = ""
Select Case [date].Month Case 1 month = " January " Case 2 month = " February " Case 3 month = " March " Case 4 month = " April " Case 5 month = " May " Case 6 month = " June " Case 7 month = " July " Case 8 month = " August " Case 9 month = " September " Case 10 month = " October " Case 11 month = " November " Case 12 month = " December " End Select
Return [date].Day & post & [date].DayOfWeek.ToString() & " ," & month & [date].Year
End Function
Usage is Simple
TextBox1.Text = ExtendDate.MuchBetterLongDateFormat(DateTime.Now)
================================================================================ Regards Hefin Dsouza ================================================================================ | DOWNLOAD SAMPLE BELOW | ================================================================================
AttachmentsDownload Sample (21351-19617-DateFun.rar)
|
No responses found. Be the first to respond and make money from revenue sharing program.
|