SQL table date/time stored in UTC, need Access function to convert to local date / time

Posted on 2012-09-04
Last Modified: 2012-09-05
I have a database that has all of the dates / time fields stored in UTC time.  I need a function in access to display the date / time based on the local time zone.

Example: in sql i have a date / time stored for a change to a record and it is 5 hours ahead of my local time.  

in sql  9/4/2012 5:15:27 PM  I'd like to view this in
access in central time (GMT -6) - 9/4/2012 12:15:27PM

Thank you in advance.
Question by:BFanguy

    Author Comment

    is this all i need to do?


    does this take care of daylight savings time.....
    LVL 30

    Accepted Solution

    This just subtracts 5 hours from date.

    Daylight savings has to be managed in the original data captured.

    You can check by listing few values including Daylight savings entries.
    LVL 48

    Assisted Solution

    by:Gustav Brock
    LVL 25

    Assisted Solution

    I tried the functions from here

    They seem to work fine in doing a local->UTC (GMT) and back based on limited testing by just doing:
    select now() as current_time, ConvertLocalToGMT(now()), ConvertGMTToLocal(now()), datediff("h", ConvertLocalToGMT(now()), now()),  datediff("h", ConvertGMTToLocal(now()), now())

    Author Closing Comment

    Thanks guys,  I will try all 3 solutions.
    LVL 48

    Expert Comment

    by:Gustav Brock
    You are welcome!


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now