View Single Post
 
Old 09-06-2023, 09:09 AM
ArviLaanemets ArviLaanemets is offline Windows 8 Office 2016
Expert
 
Join Date: May 2017
Posts: 932
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default Converting a date to sring using FORMAT() gives wrong format

Hi

I'm creating an Excel converter app, which reads data from client's forecast file, and writes a text file used to import those data to ERP program.

I tried in VBA procedure to convert date to string, using code like:
Code:
...
strDateString = Format(datDate, strDateFormat)
...
where strDateformat is "dd/mm/yyyy" (it is read from Setup sheet of converter, i.e. user can determine, what the format must be). The local date format for my computer is "dd.mm.yyyy", and this is the format the VBA returns. (And this is really what the Format() function returns - I checked it in Immediate window!). So what about Format function converting the date to string in given format?
Reply With Quote