Thread: Date bug
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Date bug

It isn't a bug - Excel VBA is US Centric in terms of most date handling.
If you are passing in a string that is dd/mm/yyyy, then you will get the
results you describe with ambiguous dates (where it could be interpreted as
mm/dd/yyyy)

It is best to work with date serial numbers in VBA.

that said, cdate is supposed to observe your regional settings, so try
Format(cdate(Date$), "dd, mmm, yyyy")


Regards,
Tom Ogilvy


"Mike Berry" wrote in message
...
Hi all,

Not sure if this is me or a known problem, and is so if
there is a work around.

I am using a date function as follows:

Format(Date$, "dd, mmm, yyyy")

The month seems to be getting confused if the actual day
is before the 12th. For example today is the 11th July
(11/07) but it is being read as the 7th November (07/11).
When I change my system date to 13th July it reads it
perfectly. I have tried this on other peoples machines
and the error is generated in the same way.

Has anyone come across this and if so is there a solution
to it ?

Thanks,

Mike.