?
Solved

Convert PST time to GMT or IST in MS ACCESS

Posted on 2007-12-06
3
Medium Priority
?
44,116 Views
Last Modified: 2010-04-21
I've a issue where the columns stores the date, starttime and end time in PST time zone. I want to add another column (computed if possible) and convert the date/time to IST. Is this possible? How can I do it?
0
Comment
Question by:rsrsm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 51

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 20419175
Obtain the time zone bias of the two time zones and apply the functions below.

/gustav


Public Function DateAddTimeZoneDiff( _
  ByVal datLocal As Date, _
  ByVal lngLocalBias, _
  ByVal lngRemoteBias) _
  As Date
  
' Calculates the date/time of datLocal in a remote time zone.
' Adds the difference in minutes between the local time zone bias and
' the remote time zone bias, if both bias are relative to UTC.
'
' Examples:
'
'   datRemote = DateAddTimeZoneDiff(Now(), 60, -600)
' will return datRemote as eleven hours ahead of local time.
'
'   datRemote = DateAddTimeZoneDiff(Now(), -600, 60)
' will return datRemote as eleven hours behind local time.
'
' 2000-05-30. Cactus Data ApS, CPH.
' 2005-01-25. Adjusted to accommodate change in TimeZoneBiasDiff().
 
  Dim datRemote As Date
  Dim lngBias   As Long
  
  ' Get difference (in minutes) in time zone bias.
  lngBias = TimeZoneBiasDiff(lngLocalBias, lngRemoteBias)
  ' Calculate remote date/time.
  datRemote = DateAdd("n", lngBias, datLocal)
  
  DateAddTimeZoneDiff = datRemote
  
End Function
 
 
Public Function TimeZoneBiasDiff( _
  ByVal lngLocalTimeBias As Long, _
  ByVal lngRemoteTimeBias As Long) _
  As Long
  
' Calculates the difference in minutes between two time zones,
' typically from the local time zone to the remote time zone.
' Both time zones must be expressed by their bias relative to
' UTC (Coordinated Universal Time) which is measured in minutes.
'
' 2000-05-30. Cactus Data ApS, CPH.
' 2005-01-25. Output reversed to express bias value.
 
  ' Minimum amount of minutes for a time zone bias.
  Const clngTimeZoneBiasMin As Long = 15
 
  Dim lngTimeZoneBiasDiff As Long
  
  ' Round off time zone bias by minimum time zone difference.
  lngLocalTimeBias = lngLocalTimeBias \ clngTimeZoneBiasMin
  lngLocalTimeBias = lngLocalTimeBias * clngTimeZoneBiasMin
  lngRemoteTimeBias = lngRemoteTimeBias \ clngTimeZoneBiasMin
  lngRemoteTimeBias = lngRemoteTimeBias * clngTimeZoneBiasMin
  
  ' Calculate difference in time zone bias.
  lngTimeZoneBiasDiff = lngLocalTimeBias - lngRemoteTimeBias
  
  TimeZoneBiasDiff = lngTimeZoneBiasDiff
 
End Function

Open in new window

0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 500 total points
ID: 20425260
rsrsm,

According to this link:
http://www.timegenie.com/timezones.php#notes_about_GMT
IST can mean Indian Standard Time OR Ireland Standard time, so be carefull in your terminlogy.
;)

If you have PST (Pacific Standard Time) you must add 13.5 hours (810 minutes) to get Indian Standard Time.

If you want to use a Query, it would look something like this:

SELECT tblTimes.PST, DateAdd("n",810,[PST]) AS IST
FROM tblTimes;

Here is a sample:
https://filedb.experts-exchange.com/incoming/ee-stuff/6036-Access--EE-Q-23005637Convert-Ti.zip

JeffCoachman

0
 

Author Closing Comment

by:rsrsm
ID: 31413108
I was able to arrive at a solution using both the answers, hence I'm accepting both the answers and splitting the points.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

762 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