Solved

VbScript is not returning correct Date format

Posted on 2011-09-16
4
415 Views
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




sample.csv
Script.vbs
1.txt
0
Comment
Question by:plusone3055
[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 82

Accepted Solution

by:
hielo earned 500 total points
ID: 36550401
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

0
 
LVL 48

Expert Comment

by:Martin Liss
ID: 36550406
Use Filedate = Format(CSVDate, "mm/dd/yyyy")
0
 
LVL 22

Author Comment

by:plusone3055
ID: 36550416
martinLiss
where should i insert that what line ?
0
 
LVL 22

Author Closing Comment

by:plusone3055
ID: 36550434
PERFECT :)
thank you much
0

Featured Post

Industry Leaders: 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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

718 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