Hi Community.
I'm using com-handle becouse I'm updating information into my table using a Excel file.
But I have a little problem, I don't know convert this value "2014-10-08" to date value.
I use this code:
cRango = "AD" + STRING(iren).
CHHOJA:RANGE(cRango):NumberFormat = "@".
chhoja:range(cRango):VALUE = string((chhoja:range(cRango):VALUE),"9999/99/99").
and this:
cRango = "AD" + STRING(iren).
CHHOJA:RANGE(cRango):NumberFormat = "date".
chhoja:range(cRango):VALUE = date(chhoja:range(cRango):VALUE).
Can you help me?.
Thanks.
Looks like your OE SESSION:DATE-FORMAT doesn't match what you are getting back from Excel.
You can specify the NumberFormat to be "mm/dd/yyyy" (probably much easier) or you can change the SESSION:DATE-FORMAT to "ymd" before you run the DATE function (and switch it back after).
In Excel (not tied to any database), if you have A1 = '2015-6-30, you can format it in B1 = TEXT(A1,"YYYY-MM-DD"), which will show 2015-06-30; C1 = DATEVALUE(B1), which you can format it to whatever date format you desire like 30-Jun-2015; and D1 = C1+1, which will show 1-Jul-2015.
Hi my friends.
Tanks for your help.
I solved my problem using the SESSION:DATE-FORMAT was most easy.
My solution is this:
SESSION:DATE-FORMAT = "ymd"
fec = CHHOJA:Range(obtencol(icol) + STRING(iren)):VALUE.
tempexcel.fechaact = fec.
where fec is an date variable.
tempexcel is a temp-table.
icol and iren are integer variable.
CHHOJA is a com-handle.
Thanks for our help TheMadDBA and eugenel.
No problem :-)
Don't forget to set the DATE-FORMAT back to the original value after you are done. Otherwise you will run into other issues.