Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2012
    Posts
    31

    Unanswered: Convert Date to numbers

    Hi

    How to convert the date NOW to integer..?

    Thanks in advance
    Any reply would be much appreciated,,,

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    To an integer, you can't (overflow). To a long:
    Code:
    Debug.Print CLng(Now)
    Yields 41370 at the moment where I type this (2013-04-05). However, it does not make a lot of sense to me.
    Have a nice day!

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    why would you want to?
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Dec 2012
    Posts
    31
    I want that value to become my unique ID


    thanx..

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    why not just use the datetime value then.
    under the hood Access/JET stores datetime values as (IIRC) a double precision value:-
    the integer bit is the number of days since an arbotary date (31/12/1899)
    the dcimal bit is the proportion of the day (so .5 ia 12:00:00, .175 is 18:00, 1/60/60/24 is 00:00:01.

    however bear in mind that this will limit you to a unique record per second

    the other alternative is to use an autogenerated number which guarantees you can store as many rows as required with the same datetime.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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