473,769 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Time conversion

I'm a novice in this subject....I've made a database that requires a
time conversion. For example, if local time is 1200, determine the
time in Korea. I use two fields: a date field, and a time field. I
need the converted time to show up in a report. I also need the
corresponding date to increment if necessary. Any ideas on how to do
this would be greatly appreciated.
Nov 12 '05 #1
1 11685
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The world is divided into different time zones (see the Map of time
zones, below). Each zone is designated X number of hours from
Greenwich Mean Time (or UTC: Universal Temp Coordination [Universal
Coordinated Time] - pardon my French). To get an accurate time of a
location in the world you'd have to convert your time to UTC (when
your time zone is negative, you'd have to ADD hours to UTC; when your
time zone is positive, you'd have to SUBTRACT hours from UTC.) then
add/subtract number of hours other location is from UTC.

Example (this doesn't include Day Light Savings Time [another can of
worms, since each country defines their own], see free time conversion
software, below):

Oakland time: 21 Nov 2003 1200.

Oakland is -8 UTC
Get UTC: 1200 + 8 = 2000 UTC

Korea is +9 UTC
Get Korea's time relative to previously calculated UTC:
2000 + 9 = 2900 = 1 day & 5 hrs or 22 Nov 2003 0500

===

Items from Google search on "time zone":

Map of time zones:
http://www.worldtimezone.com/

Free software to get time in different zones (untested):
http://www.timezonesforpcs.com/details.htm
Here is some VBA code I devised to get UTC.

== Begin Code ==

Private Const LOCALE_SYSTEM_D EFAULT& = &H800

'************** *************** *****
'** Type Definitions:

Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type

Private Declare Sub GetSystemTime Lib "kernel32" _
(lpSystemTime As SYSTEMTIME)

Private Declare Sub GetLocalTime Lib "kernel32" _
(lpSystemTime As SYSTEMTIME)

Private Declare Function GetTimeFormat& Lib "kernel32" Alias _
"GetTimeFormatA " (ByVal Locale As Long, ByVal dwFlags As Long,
_
lpTime As SYSTEMTIME, ByVal lpFormat As Long, _
ByVal lpTimeStr As String, ByVal cchTime As Long)

Sub ShowTime()

Dim myTime As SYSTEMTIME
Dim strBuffer As String
Dim lng As Long

GetLocalTime myTime
strBuffer = String$(255, Chr$(0))
lng = GetTimeFormat&( LOCALE_SYSTEM_D EFAULT, 0, _
myTime, 0, strBuffer, 254)
Debug.Print "Local Time = "; strBuffer
With myTime
Debug.Print "Local Date = "; _
DateSerial(.wYe ar, .wMonth, .wDay)
End With

GetSystemTime myTime
strBuffer = String$(255, Chr$(0))
lng = GetTimeFormat&( LOCALE_SYSTEM_D EFAULT, 0, _
myTime, 0, strBuffer, 254)
Debug.Print "GMT Time = "; strBuffer
With myTime
Debug.Print "GMT Date = "; _
DateSerial(.wYe ar, .wMonth, .wDay)
End With

End Sub

== End Code ==

HTH,

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP78Qk4echKq OuFEgEQJYbgCeLV +f5fbdUyBG+0iWf 3cI3Ld+XyYAoN+q
3CMpyI3yxEqOlGJ tQu2rjes7
=yo22
-----END PGP SIGNATURE-----

heirou wrote:
I'm a novice in this subject....I've made a database that requires a
time conversion. For example, if local time is 1200, determine the
time in Korea. I use two fields: a date field, and a time field. I
need the converted time to show up in a report. I also need the
corresponding date to increment if necessary. Any ideas on how to do
this would be greatly appreciated.

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
11717
by: dan glenn | last post by:
Say, I want to set a cookie and have it expire an hour after it's set. It's looking like this is only possible for browsers which are in the same time zone as my server?? In other words, if I set my cookie with: setcookie('CookieName', $SomeValue, time()+3600, "/");
2
2815
by: learning_C++ | last post by:
I programmed this code with a function "get_current_time" in the begining. When I compiled with the command g++ -Wall -g xxx.xpp -o xxx there are so many errors. please help me and thanks, #include <map> #include <iostream> #include <iomanip> #include <string> #include <time.h>
6
2069
by: DCSudolcan | last post by:
I know that a program can create and properly initialize an array of pointers to functions at build time, but can something like the following be done at build time? void foo(void); unsigned char myArray={ (unsigned char) (foo&0xFF), (unsigned char) ((foo&0xFF00)>>8), (unsigned char) ((foo&0xFF0000)>>16),
5
4677
by: Paulers | last post by:
Hello, I'm working on an app that requires the functionality to convert the time in Austrailia to the time in New York (EST). I am wondering, what is the bestway to approach this in vb.net? Is there anything in VB.net that can make this conversion? If not, is it possible to hit a time server of some sort to get the conversion? I know there are time conversion websites all over the place Im just wondering if any of them allow an...
3
2889
by: Jason S | last post by:
is there any way to use templates to bind integer/floating point constants to a template for compile-time use? e.g. template <double conversion> class meters { const factor = conversion;
3
2758
by: moni | last post by:
Hi, I wanted to convert a time value in the form of time_t into a readable form in C# or vice versa, in order to be able to subtract two time values and give the result in msecs. eg. I have a time value,
3
2478
by: Evan Klitzke | last post by:
Although it is not present in ANSI C, the GNU version of stftime supports the conversion character %z, which is a time offset from GMT. The four digit time offset is required in RFC 2822 dates/times, and is used by a number of other programs as well. I need to convert times that use this convention to python time representations, and because Python does not support the %z time conversion character I cannot simply use the time.strptime...
5
3176
by: fimarn | last post by:
I am trying to get rid of compile time error that I am getting only in RHEL5 (not in RHEL4) apparently due to the changes in the stl_list.h file. The error that I am getting is coming from the following code that attempts to remove an item from the list: class shm_objptr_list : public std::list < void*, SharedMemAlloc<void * > {
5
8523
by: Grey Alien | last post by:
I need to convert timestamps that are given as the number of seconds that have elapsed since midnight UTC of January 1, 1970, (not counting leap seconds). It seems all of the std C functions expect positive offsets from this date and are incapable of working on dates preceeding the epoch (i.e. negative offsets) - which IMHO shows a remarkable lack of foresight - and is *just* a little bit annoying. Does anyone know of an algo I can...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7403
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.