Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Date format issue when writing to Excel **solved**

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,53772
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Date format issue when writing to Excel **solved**
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Date format issue when writing to Excel **solved** - 11/23/2007 12:28:49 PM   
  BBistheKing

 

Posts: 107
Score: 0
Joined: 6/21/2005
Status: offline
I'm having a problem with date formatting when writing to excel. When ever the date has a leading zero (eg. 03/12/2005 - Australian format dd/mm/yyyy) the day and month are reversed when I open the spreadsheet. I have tried formatting the column to dd/mm/yyyy when the spreadsheet is created but the propblem persists. I have also tried using NumberFormat after and before the value is written to the spreadsheet. Pre-formatting the column works when I type a date with a leading zero manually into the spreadsheet, but when the script writes to the spreadsheet the problem persists. I can't even manually reformat it without retyping the date in first.

It needs to be in the correct format (dd/mm/yyyy), with leading zero. Any help or clues would be greatly appreciated.

Here is the test code:


      

< Message edited by BBistheKing -- 11/24/2007 2:33:13 PM >


_____________________________

"Live simply, that others may simply live." - Mahatma Gandhi
 
 
Post #: 1
 
 RE: Date format issue when writing to Excel **solved** - 11/24/2007 2:35:06 PM   
  BBistheKing

 

Posts: 107
Score: 0
Joined: 6/21/2005
Status: offline
problem solved - converted date string using DateValue before writing to excel. I don't know why I didn't think of it sooner.

_____________________________

"Live simply, that others may simply live." - Mahatma Gandhi

(in reply to BBistheKing)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Date format issue when writing to Excel **solved** Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts