+ Reply to Thread
Results 1 to 3 of 3

Covert UTC date

  1. #1
    Registered User
    Join Date
    12-02-2005
    Posts
    7

    Covert UTC date

    I currently have a field coming out of a database with the call_time is 10 digit UTC format (simply the number of seconds that have passed from that moment since 1970. I have converted it in Brio, but am not that savy with VBA or Excel. Does anyone know how I can do this? I have attached the script I use in Brio below:

    CONVERT(varchar(50),DATEADD(ss, (call_time + (1799-(((call_time % 86400)% 1800)))) - DATEDIFF(hh, GETDATE(), GETUTCDATE()) * 3600, 'Jan 01, 1970 12:00AM'),114)

    If anyone can help, I would REALLY appreciate it!!

    Shawn.

  2. #2
    Tom Ogilvy
    Guest

    Re: Covert UTC date

    =(C1/86400)+DATE(1970,1,1)

    or in VBA

    (assume your value is in the variable lngUTC)

    Dim dt as Date
    dt = lngUTC/86400 + DateSerial(1970,1,1)

    msgbox format(dt,"mm/dd/yyyy hh:mm")


    --
    Regards,
    Tom Ogilvy



    "smpayne69" <[email protected]> wrote
    in message news:[email protected]...
    >
    > I currently have a field coming out of a database with the call_time is
    > 10 digit UTC format (simply the number of seconds that have passed from
    > that moment since 1970. I have converted it in Brio, but am not that
    > savy with VBA or Excel. Does anyone know how I can do this? I have
    > attached the script I use in Brio below:
    >
    > CONVERT(VARCHAR(50),DATEADD(SS, (CALL_TIME + (1799-(((CALL_TIME %
    > 86400)% 1800)))) - DATEDIFF(HH, GETDATE(),
    > GETUTCDATE()) * 3600, 'JAN
    > 01, 1970 12:00AM'),114)
    >
    > If anyone can help, I would REALLY appreciate it!!
    >
    > Shawn.
    >
    >
    > --
    > smpayne69
    > ------------------------------------------------------------------------
    > smpayne69's Profile:

    http://www.excelforum.com/member.php...o&userid=29307
    > View this thread: http://www.excelforum.com/showthread...hreadid=490251
    >




  3. #3
    Registered User
    Join Date
    12-02-2005
    Posts
    7

    Question

    Thank you for your assistance!

    Excuse me for my ignorance with Access and VBA, but how can I apply this in Access? I have a table that has times like 3098739942 and want to have it converted during the query so that the new table has correct time values.

    Do I make a small module with the command you gave me and call it during the query, or something??

    Thanks again!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1