tobject Posted August 4, 2010 Share Posted August 4, 2010 I'm getting back "20100804000000" instead of "2010-08-04" anyonee knows why? $oSheet = $oExcel.Worksheets.Item(1); $ReportMaxRows = $oSheet.UsedRange.Rows.Count; _ExcelNumberFormat($oExcel, "YYYY-MM-DD",1, 3, $ReportMaxRows,3); for $iNdx= 1 to $ReportMaxRows $Company=$oExcel.Activesheet.Cells($iNdx, 1).Value; $Time=$oExcel.Activesheet.Cells($iNdx, 2).Value; $Date =$oExcel.Activesheet.Cells($iNdx, 3).Value; MsgBox(0,"sdsdsd",$Date ); Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 4, 2010 Share Posted August 4, 2010 That's the way Excel stores date/time. Use .Text instead of .Value to get the text representing that value. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
beantang Posted May 22, 2011 Share Posted May 22, 2011 I think I met the same problem.But After I changed the format to the String, I got another string rather than 20100804000000.When I write it to a Excel cell, it has not turned back.Why? How can I get "2010-08-04"? Link to comment Share on other sites More sharing options...
JoHanatCent Posted May 22, 2011 Share Posted May 22, 2011 (edited) I think I met the same problem.But After I changed the format to the String, I got another string rather than 20100804000000.When I write it to a Excel cell, it has not turned back.Why? How can I get "2010-08-04"? beantang - Welcome to this forum. This is an old post and you'd be better off starting a new post with your own example script. The solution that PsaltyDS gave is working. Else you can use this to just convert it: $Date = "20100804000000" $Date = StringLeft($Date, 4) & "-" & StringMid($Date, 5, 2) & "-" & StringMid($Date, 7, 2) MsgBox(0, '', $Date, 2) Edited May 22, 2011 by JoHanatCent Link to comment Share on other sites More sharing options...
beantang Posted May 28, 2011 Share Posted May 28, 2011 Thanks.I'd like to do that. But before I start a new post, can you tell me why could I get the special string? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now