?
Solved

ASP.Net Date Format

Posted on 2013-05-22
3
Medium Priority
?
307 Views
Last Modified: 2013-05-23
Hello Experts
Can someone please help with a simple code snippet to return the following

Input Param: Dec-15
Output Param: 12-20015

 d = "Jan-15"
 Public Shared Function GetExpiryDate(ByVal d As String) As String
        Dim DateString = d.Split("-")        
	Dim RetVal As String = ""

        'Sort out the month part


        'Sort out the rest of the string

        'RetVal = "01-2015"
        Return RetVal

    End Function

Open in new window

0
Comment
Question by:newbie27
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 2000 total points
ID: 39188521
Dim DateString as String[] = d.Split("-")        
      Dim RetVal As String = ""

        'Sort out the month part
         Select Case
                  Case "Jan"
                     RetVal = "01"
                   Case "Feb"
                      RetVal = "02"
                  Case "Mar"  
                       RetVal = "03"
                  Case "Apr"
                       RetVal = "04"
                  Case "May"
                        RetVal = "05"
                  Case "Jun"
                        RetVal = "06"
                  Case "Jul"
                     RetVal = "07"
                   Case "Aug"
                      RetVal = "08"
                  Case "Sep"  
                       RetVal = "09"
                  Case "Oct"
                       RetVal = "10"
                  Case "Nov"
                        RetVal = "11"
                  Case "Dec"
                        RetVal = "12"
          End Select

        'Sort out the rest of the string
          RetVal = RetVal + "20" + DateString[1]
        'RetVal = "01-2015"
        Return RetVal
0
 
LVL 8

Author Closing Comment

by:newbie27
ID: 39190365
Thanks
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 39190398
Glad to be of assistance

AW
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Integration Management Part 2
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question