Problem Date time field

Hi All,

I have one date filed and i just export this value from Notes document to Excel file but in notes document it show dd-mm-yy format and when you try to export same to excel it is converted to mm-dd-yy format and i have no idea why this changed i have already try formatting and all this possibility but not working , My code is below

Sdate = Cstr(Doc.FromDate(0)) - It show dd-mm-yyy

BkgDay = Left(Sdate, 2)

BkgMm = Mid(Sdate, 4, 2)

BkgYy = Right(Sdate, 2)

xlObj.Cells(Row, 4).value = BkgDay+“-”+Bkgmm+“-”+BkgYy - Problem here it show in excel file mm-dd-yy

Subject: Problem Date time field

My guess is that you have the Excel cells set to a different date format (US instead of British). It seems like when Excel receives a date value in a cell , it will automatically convert it to match the date format for that cell.

Also, it would be much easier for you to use Format$ to change a date value to a string in desired format:

xlObj.Cells(Row, 4).value = Format$(Cdat(doc.GetItemValue(“FromDate”)(0)),“dd-mm-yyyy”)

or

xlObj.Cells(Row, 4).value = Format$(Cdat(doc.GetItemValue(“FromDate”)(0)),“Short Date”)