How do you recover the number of seconds stored in a DateTime object?

  1. last week

    Robert L

    Nov 1 Federal Way, WA (Seattle Area)

    From the Documentation:

    A DateTime object stores the number of seconds since 12:00 AM, January 1, 1970

    Fine. How do I get that value in a Double or whatever.

    Var nowDate As DateTime 
    nowDate = DateTime.Now

    Can I find out how many seconds there have been since 12:00 AM, January 1, 1970?
    i.e. what is the number of seconds that nowDate is storing?

    well according to the LangRef

    dim seconds as double =nowDate.secondsfrom1970
  2. Dave S

    Nov 1 Answer San Diego, California USA

    well according to the LangRef

    dim seconds as double =nowDate.secondsfrom1970
  3. Tim P

    Nov 1 Pre-Release Testers Rochester, NY
    Edited last week

    http://docs.xojo.com/DateTime.SecondsFrom1970

    Edit: by seconds!

  4. Markus R

    Nov 2 Pre-Release Testers, Xojo Pro Europe / Germany
    Edited last week

    (sorry i ask here)
    why it is a double (floating point numbers) and not a long integer???
    because milli seconds?

  5. Ulrich B

    Nov 2 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...
    Edited last week

    @Markus R (sorry i ask here)
    why it is a double (floating point numbers) and not a long integer???
    because milli seconds?

    They could be used for it. But mainly because Double has a much wider range than Int64: max 1.7 x 10^308.

or Sign Up to reply!