Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date- 06-Apr-2006
Message
From
16/04/2006 13:23:06
 
 
To
16/04/2006 12:49:46
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01113931
Message ID:
01113937
Views:
16
>How can I change the date into this format ??
>2006/4/6 into "06-Apr-2006"

I wasn't able to find a syntax in the format string which would allow to get those three format character month layout having the first letter in uppercase. But, the following does it:
    ' Return a date in a universal format
    ' expD1 Date
    Public Shared Function DateTest(ByVal tdDate As Date) As String
        Dim lcDate As String
        Dim lnDay As Integer
        Dim lnMonth As Integer
        Dim lnYear As Integer
        Dim lcMonth As String
        lcDate = ""
        lnDay = tdDate.Day
        lnMonth = tdDate.Month
        lnYear = tdDate.Year
        lcMonth = ""

        Select Case lnMonth
            Case 1
                lcMonth = "January"
            Case 2
                lcMonth = "February"
            Case 3
                lcMonth = "March"
            Case 4
                lcMonth = "April"
            Case 5
                lcMonth = "May"
            Case 6
                lcMonth = "June"
            Case 7
                lcMonth = "July"
            Case 8
                lcMonth = "August"
            Case 9
                lcMonth = "September"
            Case 10
                lcMonth = "October"
            Case 11
                lcMonth = "November"
            Case 12
                lcMonth = "December"
        End Select

        lcDate = lcDate + lnDay.ToString.PadLeft(2, "0") + "-" + Mid(lcMonth, 1, 3) + "-" + Trim(lnYear.ToString)
        Return lcDate
    End Function
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform