Jump to content

Recommended Posts

Posted

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 );

  • 9 months later...
Posted

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"?

Posted (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 by JoHanatCent

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...