Results 1 to 9 of 9
  1. #1
    shmuel is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    4

    converting timestamp to normal dates

    hello,
    I load to acsess tsv file from external database.

    The dates in it are defined by timestamp like that
    1364774802
    1364774887
    1364775537
    1364776297

    By proposing of external database experts I convert them to excell timestamp by formula:
    =(A1/86400)+25569
    And getting numbers like:
    41365.00
    41365.01
    41365.01
    41365.02
    41365.02
    If I use excell I just format cells to dates and I get normal dates:


    1/4/13
    1/4/13
    1/4/13
    1/4/13
    How can I get normal dates from those timestamps in acsess (as excell is too limited)

    Thanks!!!

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Import your data into Access. Assuming that there was only the one field imported, then in a query convert to the date format. Sheet1 is your table name and Field1 is the imported timestamp.

    SELECT Sheet1.Field1, Format(Int(([Field1]/86400)+25569),"Short Date") AS Expr1
    FROM Sheet1;
    Attached Files Attached Files

  3. #3
    shmuel is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    4
    Thank you a lot!!!
    I created new column DATE using ZOOM based on timestamp as you suggested where Field1 is timestamp and action is table.
    DATE: SELECT action.Field1, Format(Int(([Field1]/86400)+25569),"Short Date") AS Expr1
    FROM action
    I'm trying to run this but get the error message
    "the syntax of the subquery in this expression is incorrect". Could you please suggest where is my syntax error? thanks again

  4. #4
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Why are you doing a subquery and not just an expression as I have demonstrated.

  5. #5
    shmuel is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    4
    thanks, I succeeded to create new variable Date using your suggestion. Another difficulty is converting the date into the Week Number.
    I understand there is no such a function in assess, thanks again for your help!

  6. #6
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529

  7. #7
    shmuel is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    4
    great thanks again! I succeeded to do that
    Another question I still have unfortunately. I'm trying to retrieve column in query that will be equal to day previous to day received from time stamp calculation...
    I use formula Format(Int(([Field1]/86400)+25569),"Short Date")-1, but all the columns turn to be #error.
    Thanks again for your kind help ))

  8. #8
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Need to change it to this: Format(Int(([Field1]/86400)+25569)-1,"Short Date")

    Need the -1 in the Date calculation part of the expression and not in the format part.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    That is because Format function actually results in a string entity, not a true date value.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Converting Dates into week numbers (custom)
    By Bleep-Blop in forum Programming
    Replies: 5
    Last Post: 10-04-2013, 03:29 PM
  2. Replies: 7
    Last Post: 03-18-2013, 04:54 PM
  3. Replies: 1
    Last Post: 09-06-2011, 05:24 AM
  4. Converting dates from a field with blank records
    By NOTLguy in forum Programming
    Replies: 3
    Last Post: 10-14-2010, 06:38 AM
  5. Replies: 2
    Last Post: 07-03-2010, 08:45 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