Solved

Convert MM/DD/YY to MMDDYY

Posted on 2010-09-14
4
1,002 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 14

Accepted Solution

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

Expert Comment

by:Huseyin KAHRAMAN
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 53

Expert Comment

by:Huseyin KAHRAMAN
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

740 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