?
Solved

VbScript is not returning correct Date format

Posted on 2011-09-16
4
Medium Priority
?
420 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 2000 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 49

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

Independent Software Vendors: 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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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