Date Compression and Recovery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RobH
    New Member
    • Jul 2007
    • 56

    Date Compression and Recovery

    If this don't mess with your head - nothing will.

    I need to take the value of now() eg 3/aug/2007 10:35pm and compress it to a much smaller code.

    So far I have tried Hex(Now()) which results in 9987 which is ideal size

    But how do I then get the 9987 back to a date format of 3/aug/2007 10:35pm?
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by RobH
    If this don't mess with your head - nothing will.

    I need to take the value of now() eg 3/aug/2007 10:35pm and compress it to a much smaller code.

    So far I have tried Hex(Now()) which results in 9987 which is ideal size

    But how do I then get the 9987 back to a date format of 3/aug/2007 10:35pm?
    I cannot for the life of me figure out why you would want to do this, but how about storing the number of seconds from an arbitrary Date/Time, say 1/1/2007 12:00 PM until Now() as in:
    [CODE=vb]Debug.Print DateDiff("s", Now(), #1/1/2007 12:00 PM#)
    'When I ran the code line, the Date/Time was 8/2/2007 9:39:26 PM. The Output was -18437966 which you would store internally.[/CODE]

    [CODE=vb]'To retrieve the initial value of Now():
    Debug.Print DateAdd("s",184 37966,#1/1/2007 12:00 PM#)
    'Produces 8/2/2007 9:39:26 PM[/CODE]

    I don't really think that this is what you are looking for, but if you explain your reasoning for this request, we may be better able to arrive at a solution.

    BTW, to retrieve the Decimal Equivalent of your Hexadecimal Value returned from Hex(Now()), namely 9987, you can use Val(&H9987) which would return -26233, but I really do not know what the significance of this number is right now. Good night - going to bed!

    Comment

    • RobH
      New Member
      • Jul 2007
      • 56

      #3
      I hope this helps..

      I need to embed the date and time into a quote reference number without making it obvious that its a date and time

      So the end format I'm looking for would be 7-132343.1986

      The 7 representing the Sales Rep ID #
      The 132343 being the consultation request #
      The 1986 being the date/time code

      This way I can extract the different items later for use in the admin backend.

      This way the head office staff can look at a quote and know who raised the quote, what the consult request ID was and work out the date&time.

      Oh its currently 12:37pm here in Melbourne, Australia. - Your the one who should be in bed :)

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by RobH
        I hope this helps..

        I need to embed the date and time into a quote reference number without making it obvious that its a date and time

        So the end format I'm looking for would be 7-132343.1986

        The 7 representing the Sales Rep ID #
        The 132343 being the consultation request #
        The 1986 being the date/time code

        This way I can extract the different items later for use in the admin backend.

        This way the head office staff can look at a quote and know who raised the quote, what the consult request ID was and work out the date&time.

        Oh its currently 12:37pm here in Melbourne, Australia. - Your the one who should be in bed :)
        How about appending something like the Julian Date and a Formatted Time to your Quote Reference Number. For instance, if I wanted to generate this number for 8/3/2007 @ 07:23:57, the code would be:
        [CODE=vb]
        DateDiff("d", #1/1/2007#, Now()) & Format$(Now(), "hhmmss")
        [/CODE]
        This would produce 214072357 where 214 is the Julian Date and 072357 would be the time (7:23:57 AM) and the Quote Reference Code would now be: 7-132343.21407235 7. The Date/Time code is masked and easily retrievable.

        Comment

        Working...