Solved

Convert MM/DD/YY to MMDDYY

Posted on 2010-09-14
4
999 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

813 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

11 Experts available now in Live!

Get 1:1 Help Now