|
-
August 27th, 2001, 03:14 PM
#1
Combine Date and Time in one variable
Hi,
I have two Date variables, the first
one contains a Date, and the other one
contains a Time.
I want to combine them into one variable
that will hold the date from the first
variable, and the time from the
second variable.
I managed to do so by converting them to
strings then assigning the resulting string
into the third variable.. as in the
following example:
Dim da1 as date, ti1 as date, cmb as date
da1 = #9/2/2001#
ti1 = #6:30:00 PM#
cmb = da1 & " " & ti1
MsgBox cmb
the problem with that code is that it does
not interpret dates very well... for example
where '9' in da1 is considered december,
it is understood by cmb as day 9 of Feb!
and if I reversed it .. it still give
a wrong meaning..
however when I tested the code in my home
computer.. it works well with the same
values with no problems (both computers
running Windows 2000 Pro)..
I think that there must be a better
way to do it..
if you have any Idea or thought .. please help!
Thanks in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|