Thread: System Dates
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Mishell Mishell is offline
external usenet poster
 
Posts: 22
Default System Dates

Always ask your macro to convert it to yyyy/mm/dd - 2009-08-05 - ( not
mm/dd/yyyy or any other format) in order to always get the same date
whatever the regional settings are.

Mishell


"JT" wrote in message
...
Sure.....Users enters the deposit date as mmddyy (080509). The macro
converts this to a string "8/5/09" and then converts it to a date
(8/5/2009).
For the US cost centers this works great. Then the macor retrieves the
system date. I then use DateDiff to calculate the number of days between
each date.

The issue is with one cost center in Quebec where some of the machines
have
French Canadian Regional settings on their PC.

The "8/5/09" string is converted into 2008-09-05. When this is compared
to
the system date (2009-08-05) it is out of the 3 day range and they get an
error; when they shouldn't have.

I'm trying to get the 2 dates in sync so I can make an accurate comparison

Thanks for the help
--
JT


"Rick Rothstein" wrote:

I'm not sure exactly what problem you are encountering that prompted you
to ask your question BUT, if your dates are stored as real Dates, the
translations from system to system should be automatic. Remember, real
dates are stored as floating point numbers which have no "format"... so
the underlying value would be the same in the UK as it is in the US. Now,
if your dates are stored as Text value... then there could be problems
with conversions. Can you tell us a little more about your setup?

--
Rick (MVP - Excel)


"JT" wrote in message
...
Thanks..........What I want to do is get the date in whatever format
the
user's regional settings are set to in a variable. Then I want to take
that
result and convert it to a US date, so I can compare it to the date the
user
has entered (in a US format).


--
JT


"Rick Rothstein" wrote:

If by "date variable" you really meant a variable Dim'med "As Date",
then the answer to your question is no... sort of. Dates do not have
format until they are displayed... to VB, they are just floating point
numbers with the integer part representing the number of days past
"date zero" (December 31, 1899) and the decimal part representing the
fractional part of a 24-hour day (6:00am would be 6/24 which equals
0.25). When you display a date, VB uses your computer's Regional
Settings to figure out how to show the date to you. You can over ride
this pre-determined output using the Format function. You can also
assign the output from the Format function to a String variable, and
the text assigned to the variable will be in the form you specified in
the Format function. So, the answer to your question kind of depends
on what it is you want your code to actually do.

--
Rick (MVP - Excel)


"JT" wrote in message
...
Is it possible to convert a system date in dd/mm/yy format to the a
date
variable in the mm/dd/yy format?


--
JT