Results 1 to 4 of 4

Thread: Function for converting a long registry value to a date

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    27
    I'm pulling the registry key HKEY_LOCAL_MACHINESoftware\Microsoft\Windows NT\CurrentVersion\InstallDate on NT machines and the number contained in that key is something like 958778695. I'm guessing that the number is the number of seconds since whatever the start date was back in 1970 or so. I want to get an actual date out of the thing, i know in C++ there is a function that converts it, is there once for VB or do i need to code my own?

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    It's Just CDate(lngMyValue)

    Most Variables Can Be Converted into one another using a similar Function

    CInt() converts to integer
    CLong() Converts ti long
    CSTR ConVerts To String
    CVar converts to Variant


    I can't remember the rest, but there's a pattern, just improvise till you ving the Richt one. It's like the C++ Cast Operator.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    27
    That just causes an overflow. I know the basic type conversions for Vb but they won't do this as far as i know. If you do the calculations by hand it comes out to ~29-30 years which is about right for the install date on these machines.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    27
    http://msdn.microsoft.com/library/de.../_crt_time.htm
    That lists the various ways to do it in C.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width