Working with Windows DATE?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Working with Windows DATE?

Craig H. Anderson
Greetings,
I'm doing database work with ADO wrappers from the
 'Microsoft ActiveX Data Objects 2.5 Library' library
I don't understand how to work with the DATE datatype.
I'll need to generate a date in dolphin and compare it
to DATE's from the database.  The DATE class is defined
in the ActiveX Automation package.

A C++ method to set a DATE is:
COleDateTime::SetDateTime
int SetDateTime( int nYear, int nMonth, int nDay, int nHour, int nMin,
int nSec );

Thanks



Sent via Deja.com
http://www.deja.com/


Reply | Threaded
Open this post in threaded view
|

Re: Working with Windows DATE?

Craig H. Anderson
I've made some progress.
Convert DATE to TimeStamp.
Convert TimeStamp to Variant.

winDate " a DATE(12:00:00 AM, Thursday, June 01, 2000) "
stDate :=  winDate asTimeStamp.
stDate " TimeStamp : 12:00:00 AM, Thursday, June 01, 2000"
varFromStDate := stDate asVariant.
varFromStDate " a VARIANT(date: a DATE(12:00:00 AM, Thursday, June 01,
2000)) "

So I've gone from TimeStamp to Variant.
How do I get from Variant to DATE?



In article <935f8l$9eq$[hidden email]>,
  [hidden email] wrote:

>
>
> Greetings,
> I'm doing database work with ADO wrappers from the
>  'Microsoft ActiveX Data Objects 2.5 Library' library
> I don't understand how to work with the DATE datatype.
> I'll need to generate a date in dolphin and compare it
> to DATE's from the database.  The DATE class is defined
> in the ActiveX Automation package.
>
> A C++ method to set a DATE is:
> COleDateTime::SetDateTime
> int SetDateTime( int nYear, int nMonth, int nDay, int nHour, int nMin,
> int nSec );
>
> Thanks
>
> Sent via Deja.com
> http://www.deja.com/
>


Sent via Deja.com
http://www.deja.com/


Reply | Threaded
Open this post in threaded view
|

Re: Working with Windows DATE?

Craig H. Anderson
I got the round trip working.

tsST := (TimeStamp new) date: (Date fromString: '2/1/2001'); time:
(Time fromString: '09:30').  "9:30:00 AM, Thursday, February 01, 2001"
dateVar := tsST asVariant."a VARIANT(date: a DATE(9:30:00 AM, Thursday,
February 01, 2001))"
winDATE := dateVar date. "a DATE(9:30:00 AM, Thursday, February 01,
2001)"
tsST2 := winDATE asTimeStamp."9:30:00 AM, Thursday, February 01, 2001"


Sent via Deja.com
http://www.deja.com/


Reply | Threaded
Open this post in threaded view
|

Re: Working with Windows DATE?

Blair McGlashan
In reply to this post by Craig H. Anderson
Craig

You wrote in message news:935ilq$cj4$[hidden email]...
>..
> How do I get from Variant to DATE?

VARIANT>>value extracts the value from a VARIANT and returns an appropriate
type of Smalltalk object.

Thus if you have a VARIANT of type VT_DATE:

    TimeStamp current asVariant value.

Or if you have a VARIANT of another type:

    ('01 January 2000' asVariant changeType: (AXAutomationConstants at:
'VT_DATE')) value

Here a string variant is converted to a DATE (which can then be converted to
another date representation if desired). Incidentally this variant
conversion is the only facility the Win32 system provides to parse a date
string. Why would such a useful capability be buried in the depths of the
automation support we ask?

Regards

Blair