Hello All,

Pritpal Bedi wrote:
> 
> I am struck with one of the Active-X's ( Codejock's Calendar Control ).
> 
> Reason: it accepts and returns all events as a date field 
> but in DateTime format. It means it contains fractions in the value
> of type date. In xHarbour I can retrieve and send both values
> with its extended date/time functions but have not figured out
> how I can manage them in Harbour. 
> 

Half way down I have found the solution.
I can send the date-time value to the ole object
( and it works perfect )  as:

oOle:timeStart := Vou_DateTime( date(), '11:00' )

Function Vou_DateTime( dDate, cTime )
   Return  DateAsLong( dDate-2415019 ) + ( TimeToSec( cTime ) / ( 24*60*60 )
)


But I cannot retrieve the same info from ole.
I tried like:

aInfo := Vou_DateTime2DateTime( oOle:timeEvent )
? aInfo[1]  // 02/01/2009
? aInfo[2]  // 00:00:00

Function Vou_DateTime2DateTime( dDateTime )
   LOCAL nDtTm := DateAsDouble( dDateTime ) - 2415019
   LOCAL dDate := dDateTime
   LOCAL nSecs := ( nDtTm - Int( nDtTm ) ) * ( 24*60*60 )
  
   RETURN { dDate, SecToTime( nSecs ) }


#begindump
HB_FUNC( DATEASLONG )
{
   PHB_ITEM pDate = hb_param( 1, HB_IT_DATE );

   if( pDate )
      hb_retnl( hb_itemGetDL( pDate ) );
   else
      hb_retnl( 0 );
}

HB_FUNC( DATEASDOUBLE )
{
   PHB_ITEM pDate = hb_param( 1, HB_IT_DATE );

   if( pDate )
      hb_retnd( hb_itemGetDD( pDate ) );
   else
      hb_retnd( 0 );
}

#enddump


Any solutions?

Regards
Pritpal Bedi

-- 
View this message in context: 
http://www.nabble.com/Date-Time-Functions---Revisited-tp21767870p21779798.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to