Show the time in the users time zone?

Nasimov

New Member
Hello,

How could I show the time in the users time zone? I wouldn't mind having to ask them for there time zone when they sign up. I just want to know how to convert it and whatnot.

Thanks.
 
if your just doing a display with it, can you not use javascript to grab the system time of the local pc ?

otherwise, you could prompt for a timezone, then check that against a table of zones or something to display their local time..
 
Something like this will work.

DEFINE VARIABLE server-time AS INTEGER LABEL "Server Time" NO-UNDO.
DEFINE VARIABLE client-time AS INTEGER LABEL "Client Time" NO-UNDO.
DEFINE VARIABLE time-diff AS INTEGER NO-UNDO.

SESSION:TIME-SOURCE = "local".
client-time = TIME .
SESSION:TIME-SOURCE = "qaddb".
server-time = TIME.

time-diff = client-time - server-time.

DISPLAY
STRING(TIME + time-diff,"HH:MM:SS") LABEL "Client Time"
STRING(time,"hh:mm:ss") LABEL "Server Time"


WITH 1 COLUMN FRAME a.
 
Sorry, I missed the Webspeed title

cecsno said:
Something like this will work.

DEFINE VARIABLE server-time AS INTEGER LABEL "Server Time" NO-UNDO.
DEFINE VARIABLE client-time AS INTEGER LABEL "Client Time" NO-UNDO.
DEFINE VARIABLE time-diff AS INTEGER NO-UNDO.

SESSION:TIME-SOURCE = "local".
client-time = TIME .
SESSION:TIME-SOURCE = "qaddb".
server-time = TIME.

time-diff = client-time - server-time.

DISPLAY
STRING(TIME + time-diff,"HH:MM:SS") LABEL "Client Time"
STRING(time,"hh:mm:ss") LABEL "Server Time"


WITH 1 COLUMN FRAME a.
 
Hope this helps.

Code:
define Variable dzTimeNow as dateTime-TZ no-undo initial ?.
define varaible iTimeZone as integer no-undo initial 0

/* Time off your server. */
dzTimeNow = now.

/* 720 minutes equates to +12:00 GMT/UTC */
iTimeZone = 720.

/* Converts the server date time into the required time zone.*/
dzTimeNow = datetime-TZ(dzTimeNow, iTimeZone).

Remember this does not calculate the DST in the target timezone.
 
I am looking for something similar, but I need the actual TIME automatically calculated for me. We have hundreds of programs using just TIME, and now we have two customers in the States using the same database, but in different timezones... and I don't want to have to add a timezone calculation to them all (would take AGES!), and remember to find the timezone and add it when I write a new porgram...

I am looking for something like the SESSION: DATE_FORMAT="MMDDYY" that sets the SESSION only format, but for the time instead, so that any time is LOCAL time...
 
Back
Top