Solved

ASP.Net Date Format

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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