Solved

Convert MM/DD/YY to MMDDYY

Posted on 2010-09-14
4
997 Views
Last Modified: 2012-05-10
I am relearning VBscript, for a specific job function, as I am most used to SQL and while I should know this I simply cannot figure out how to convert MM/DD/YY to a string: MMDDYY. I have attempted to use Cstr however I get a type mismatch.

Simply just trying to take a field (Denial Date) which is MM/DD/YY and convert it to DenailStr (MMDDYY)

Thank you in advance
0
Comment
Question by:mjfigur
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
VBClassicGuy earned 500 total points
ID: 33676868
TheDate is your date string:
Replace(TheDate,"/","")
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 33676908
if it is a date format,

dim newstr
newstr = month(mydate) & day(mydate) & (year(year) mod 100)

or

newstr = month(mydate) & day(mydate) & right(year(year),2)
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 33676937
or use this
dim newstr

dim mydate

mydate = now()



newstr = right("0"& month(mydate),2) & right("0" & day(mydate),2) & (year(mydate) mod 100)

WScript.Echo newstr

newstr = right("0"& month(mydate),2) & right("0" & day(mydate),2) & right(year(mydate),2)

WScript.Echo newstr

Open in new window

0
 
LVL 13

Expert Comment

by:game-master
ID: 33678201


good morning!

try something like this..


dim strDate

strDate = format(yourDateHere, "MMDDYY")


game-master
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

708 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

13 Experts available now in Live!

Get 1:1 Help Now