15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


CTime limitation

Andreas Will -- a.will@T-Online.de
Wednesday, January 10, 1996

Madhusudana K wrote:

>I have started writing user interface to ACCESS data base using
>Database classes of MFC(Visual C++ 1.51).
>I have a problem with the CTime class.
>When the dates stored in the database are earlier than (1-1-1970)
>the CTime class fetches a date of 12-31-1969. When I want save
>a date, CTime class returns an exception error if the date is earlier than
>1-1-1970. From the MFC source, I have ound that the CTime class
>does not accept the dates earlier than 1-1-1970. Can anyone give me
>some suggestions. Is it the only to write my own RFX functions in
>the CRecordset class.

CTime encapsulates the old C time functions they are by design limited to the above mentioned time/date limit.

If you are able to use CDao... derived classes you may use the COleDateTime class, which is virtually unlimited regarding the date-, time frame.
CTime may be substituted by COleDateTime in CDao... RFX functions (they are not implemented for CRecordset derived classes :-( ).

TIMESTAMP_STRUCT may be used with CRecordset RFX functions (however, you have to do a text search in the help file to find information for this structure - its not well documented).

Best regards 
  Andy
/////////////////
Andreas Will
Jever, Germany
a.will@t-online.de
/////////////////



Brian V. Zaino 516 233-6862 -- brian.zaino@reuters.com
Friday, January 12, 1996

Madhusudana K wrote:

...
>When the dates stored in the database are earlier than (1-1-1970)
>the CTime class fetches a date of 12-31-1969. When I want save
>a date, CTime class returns an exception error if the date is earlier
than
>1-1-1970. From the MFC source, I have ound that the CTime class
>does not accept the dates earlier than 1-1-1970. Can anyone give me
>some suggestions. Is it the only to write my own RFX functions in
>the CRecordset class.

If your application is already using OLE, you might want to consider
using VARTYPEs (Variants).  In particular, VT_DATE supports date (in
seconds) since January 1st 1900.


Brian V. Zaino
Reuters Information Technology Inc.
88 Parkway Drive S.
Hauppauge, NY 11788
U.S.A.

Internet:  brian.zaino@reuters.com






| Вернуться в корень Архива |