C time/date to Visual Basic time/date 
Author Message
 C time/date to Visual Basic time/date

My problem:

I'm currently working on a DLL which has to work together with Visual
Basic. I'd like to return a date/time variable to Basic. Unfortunately
Basic stores a date as days since 12/30/1899 (double variable; the
fractional part represents hours, minutes and seconds) and C stores it as
seconds since 01/01/1970 (long variable).

I thought this would be easy and calculated the difference between these
two dates in seconds, added the number of seconds to a C variable of type
'time_t' (long) and then devided this by 86400 (number of seconds of a
day).

  {
  .
  .
  time_t timer;
  double VBtime;

  /* get current system time */
  time(&timer);

  /* VB_SECONDS = secs between 12/30/1899 and 1/1/1970 */
  VBtime=(double)(timer+VB_SECONDS);
  VBtime=(double)(timer/86400L);
  .
  .
  }

I calculated VB_SECONDS in Visual Basic and got 2209125600. But it
doesn't work this way.
If there is someone out there who has a solution, please give me a hint.

TIA,
Guido



Mon, 13 Jul 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Date Time Picker - Date AND Time

2. Date or Date and Time Data Entry

3. Q: Need algorithm to convert date-time to Julian date

4. Date Time Picker - Null Date

5. Change date field type from long to Date/Time

6. Set Date in Date Time Picker

7. Can't read time from Access 2000 date/time field

8. set date/time/time zone dialog

9. Get Real Time Clock (RTC) time/date

10. Question: Visual C++ Date and time functions

11. Serious time/date bug in Visual C++

12. Serious time/date bug in Visual C++

 

 
Powered by phpBB® Forum Software