Solved

ASP.Net Date Format

Posted on 2013-05-22
3
296 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 500 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now