Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2011

    Unanswered: cONVERT unixtimeStamp to normal date

    I am trying to convert a UNIX Timestamp to a normal date. I am using Microsoft Access 2003 on an XP Operating system. I am getting a runtime error #6. Can someone please tell me how to fix this? Here is my code:

    UNIXDateTimeStamp = 1306347240612

    Public Function sDate(UNIXDateTimeStamp As Double)
    sDate = DateAdd("s"), UNIXDateTimeStamp,"01/01/1970 hh:mm:ss")
    End Function

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    You should check the syntax of the DateAdd() function:
    DateAdd(interval, number, date)
    interval is a string expression,
    number is a numeric expression (if it's not an Integer or a Long it's converted to the nearest integer value),
    date is a Variant of subtype Date.

    It should be something like:
    sDate = DateAdd("s", UNIXDateTimeStamp, #01/01/1970#)
    but I don't know if the conversion algorithm is correct.

    Moreover, with such huge numeric values, DateAdd will return an 'error 6: Overflow'. Try to convert the UNIXDateTimeStamp from seconds to a bigger unit: hours, minutes or days first (/360, /60 or /8640).
    Have a nice day!

Posting Permissions

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