VbScript is not returning correct Date format

Posted on 2011-09-16
Last Modified: 2012-05-12
Interesting situation here
My VbScript is pulling these two columns (I eliminated others for this demo)  and placing them in a text file.

 the date in the CSV says 06/20/2011 yet its pulled to the text file as 6/20/2011..  
I need the proper MM/DD/YYYY to be transferred to the text file

Thanks in advance
Code Attached

can be execute by command

cscript Script.vbs sample.csv 1.txt

Question by:plusone3055
  • 2
LVL 82

Accepted Solution

hielo earned 500 total points
Comment Utility
on line 34 of Script.vbs, try:
objRecordset.Open " SELECT ACT_ID, FORMAT([INTRO_CID_ISSUE_DATE],'mm/dd/yyyy') as [INTRO_CID_ISSUE_DATE] FROM " & objFile.Name, objConnection

Open in new window

LVL 45

Expert Comment

by:Martin Liss
Comment Utility
Use Filedate = Format(CSVDate, "mm/dd/yyyy")
LVL 22

Author Comment

Comment Utility
where should i insert that what line ?
LVL 22

Author Closing Comment

Comment Utility
thank you much

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This Article is a follow-up to my Mappit! Addin Article (, it was inspired by an email posting I made to EUSPRIG (, I will briefly cover: 1) An overvie…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

772 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

10 Experts available now in Live!

Get 1:1 Help Now