HELP - Need help on DATE data type 
Author Message
 HELP - Need help on DATE data type

What data types are the individual pieces of a
date data type ??
If I assign  02/12/99  as a date  data type
then is the "02" an Integer, a String, or a Long ?

I ask this because in my code, I'm trying to "assemble"
a date from pieces which are gotten elsewhere in the program.
I want to do this:

Dim ThisDate as Date
ThisDate = "monthGottenElsewhere" & "/" & "dayGottenElsewhere" _
 & "/" & "yearGottenElsewhere"
 but I don't know the datatypes of the individual pieces.
... Or can you even do this ???



Wed, 20 Jun 2001 03:00:00 GMT  
 HELP - Need help on DATE data type
Date is a real number.

Other data types can be implicitly or explicitly (CDate) converted to a
date.

The answer to your question:
Converting the date parts you have into strings (use Cstr if they are
integers) and separating them with "/"'s as you're doing will produce a
string which then your code will convert into the number that can be
submitted to all date functions . . . (assuming your date parts are all
within appropriate ranges - otherwise you'll get a type mismatch error)

Quote:

> What data types are the individual pieces of a
> date data type ??
> If I assign  02/12/99  as a date  data type
> then is the "02" an Integer, a String, or a Long ?

> I ask this because in my code, I'm trying to "assemble"
> a date from pieces which are gotten elsewhere in the program.
> I want to do this:

> Dim ThisDate as Date
> ThisDate = "monthGottenElsewhere" & "/" & "dayGottenElsewhere" _
>  & "/" & "yearGottenElsewhere"
>  but I don't know the datatypes of the individual pieces.
> ... Or can you even do this ???



Wed, 20 Jun 2001 03:00:00 GMT  
 HELP - Need help on DATE data type
Very Close just add CDate() to your function and remove Quotes from around
the variables you are passing.

ThisDate = CDate( monthGottenElsewhere & "/" & dayGottenElsewhere _
  & "/" & yearGottenElsewhere)

This works for string months (i.e., "Jan", "January", "1", "01", etc.),
integer Months (i.e., 1, 2, 3)
And string/integer years.  I think this is because VB forces them to
StringVariants.
--
Steven Allyn Taylor



Quote:
> What data types are the individual pieces of a
> date data type ??
> If I assign  02/12/99  as a date  data type
> then is the "02" an Integer, a String, or a Long ?

> I ask this because in my code, I'm trying to "assemble"
> a date from pieces which are gotten elsewhere in the program.
> I want to do this:

> Dim ThisDate as Date
> ThisDate = "monthGottenElsewhere" & "/" & "dayGottenElsewhere" _
>  & "/" & "yearGottenElsewhere"
>  but I don't know the datatypes of the individual pieces.
> ... Or can you even do this ???



Thu, 21 Jun 2001 03:00:00 GMT  
 HELP - Need help on DATE data type
The CDate fuction will handle these for you. See Help.

But "Down Under" I'm moved to ask whether your sample date 02/12/99 is
dd/mm/yy or mm/dd/yy?

Barry Evans
Canberra, Australia
----------------------------

What data types are the individual pieces of a
date data type ??
If I assign  02/12/99  as a date  data type
then is the "02" an Integer, a String, or a Long ?

I ask this because in my code, I'm trying to "assemble"
a date from pieces which are gotten elsewhere in the program.
I want to do this:

Dim ThisDate as Date
ThisDate = "monthGottenElsewhere" & "/" & "dayGottenElsewhere" _
& "/" & "yearGottenElsewhere"
but I don't know the datatypes of the individual pieces.
... Or can you even do this ???



Thu, 21 Jun 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. HELP: Date/Time data type....

2. Need help! data type mismatch in criteria expression

3. Help needed with data type mismatch problem

4. Need help with yes/no Data types in DAO

5. Win32 Types To VB Types List (Help Needed)

6. Convert date serial to a date data type

7. HELP: Need help identifying DLLs with version,date,size etc

8. HELP!! Need help with Date

9. VB4: Help: data-alignment in user defined data types

10. Help: data-alignment in user defined data types

11. Date type field HELP!!

12. multipart/form-data Need just data string help

 

 
Powered by phpBB® Forum Software