Results 1 to 5 of 5
  1. #1
    Cbucci is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    3

    Date and Time

    I am putting together a query using Linked tables from our EHR Database...I have the following code that can be used within Crystal Reports:
    NumberVar ID := {document.clinicaldate};
    NumberVar Sec := Truncate (ID/1000000);
    //Convert seconds to days
    NumberVar Days := Truncate(Sec / 3600 / 24);


    // Convert days to a date and time
    DateTime(Date(1960,01,01) + Days
    , Time(0,0,0) + Sec)

    However I do not know how to do this in Access so that when I am putting together a query I can use this to alter the existing data that comes in for the field document.clinicaldate.

    An example of what comes in now is: 1472049502000000

    Any help would be great thanks.

    Chris


  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    what is 1472049502000000 ?

    a stand alone date? seconds from another date? unclear....

  3. #3
    Cbucci is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    3
    Quote Originally Posted by NTC View Post
    what is 1472049502000000 ?

    a stand alone date? seconds from another date? unclear....
    The clinical date of the document - the first ten digits (counting from left to right) are a time/date stamp in an
    encoded format representing the number of seconds since January 1, 1960.


  4. #4
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    well that's interesting.....so you'll want to research the dateadd function....

    trim that value field to the relevant digits that's a string function...

    might have to cast to integer next...not sure...

    then add those seconds to that fixed starting date - - and should equal the correct date.

    as I type this I remember that dates are fundamentally added values to a core starting point but that has always been behind the scene in the OS itself - have never seen it upfront in the user's hands.....

  5. #5
    Cbucci is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    3
    Quote Originally Posted by NTC View Post
    well that's interesting.....so you'll want to research the dateadd function....

    trim that value field to the relevant digits that's a string function...

    might have to cast to integer next...not sure...

    then add those seconds to that fixed starting date - - and should equal the correct date.

    as I type this I remember that dates are fundamentally added values to a core starting point but that has always been behind the scene in the OS itself - have never seen it upfront in the user's hands.....
    I figured out the sql to write:
    to_char(to_date('01-01-1960','MM/DD/YYYY') +
    ( trunc(d.clinicaldate/1000000) / (60 * 60 * 24) ),'MM/DD/YYYY')
    "Date"
    where d.clinicaldate is pulling in the clinicaldate value from the documents table and truncating it down to just see the seconds.

    Now I just need to figure out if Access has anything that can do this so that user's could simply put a date criteria in and have access run their report instead of me.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 02-22-2011, 03:39 PM
  2. Replies: 6
    Last Post: 01-04-2011, 05:43 PM
  3. International Date/Time
    By seen in forum Access
    Replies: 2
    Last Post: 10-05-2009, 05:29 PM
  4. Date + Time = Date Time
    By TundraMonkey in forum Access
    Replies: 3
    Last Post: 07-02-2009, 09:30 PM
  5. Access Date/Time....I need a "generic" date.
    By beastmaster in forum Access
    Replies: 2
    Last Post: 12-29-2005, 12:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums