-
Dates
Hi,
We've written an app that makes use of the DateValue() function. Specifically I create dates like this:
myDate = DateValue( dd & "/" & mm & "/" & yy )
where dd is the day number, mm the month number and yy the year. This worked fine on our own machines. When we tried this on a brand new machine we got an error. Looking at the documentation it says that DateValue creates the dates based on the short date format as set up on the local machine. The new machines were preconfigured with American standard dates (ie mm/dd/yy) and hence when I tried to set the date to be 31st July 2000 as 31/07/2000 I got an error.
Is there any way to get around this problem and force the system to recognise that I want to view all dates as dd/mm/yyyy ?
TIA
Welly
-
Re: Dates
if you are only displaying dates in this format, why not use the Format function:
txtDate.Text = Format(date,"dd/mm/yyyy")
the date can be in any format in the database, or source file, but when you want to display it - just format like so.
if you need to create a date - create a date as you normally would, then when it comes time to show it, use the format function.
hope this helps,
John
John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org
-
Re: Dates
Thanks but it doesn't help! I am actually creating dates from the raw components of day,month & year. What I think I need to know is what is the system short date format - that way I can then create dates safely.
-
Re: Dates
the GetDateFormat API might be helpful.
-
Re: Dates
Thanks - I'll have a look into that.