Solved

VbScript is not returning correct Date format

Posted on 2011-09-16
4
409 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
  • 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 46

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
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…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
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…

829 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