Day Of The Week & Time Zones 
Author Message
 Day Of The Week & Time Zones

I'm trying to create a program that beeps at 12:00 PST on Saturdays.  It
needs to have support for all US time zones.  I have two questions 1. How
can I find the day of the week? I've tried using the routines in QBSUBFUN
but it always says it's thursday (it's saturday today).  2. How can I have
the user run a type of "setup" program that saves one variable of what
timezone they are in.  It would look like this:
PRINT "Please select your time zone:"
PRINT "1. Eastern Standard"
PRINT "2. Central Time"
PRINT "3. Mountian Time" (got this from Win95, is this right?)
PRINT "4. Pacific Standard"
INPUT "",tz
Now I need to save the variable "tz" to a file and load it from the main
program as the variable tz
I plan to do this in the main program
SELECT CASE tz 'tz is the time zone
CASE 1
BEEP$="15:00:00" 'it will go off when BEEP$=TIME$
CASE 2
BEEP$="14:00:00"
CASE 3
BEEP$="13:00:00"
CASE 4
BEEP$="12:00:00"
END SELECT
IF day$="sat" THEN
DO WHILE TIME$<>BEEP$:LOOP
BEEP
BEEP
BEEP
PRINT "Time for a meeting."
END IF
Keep in mind that I only want the user to enter the time zone once, not
everytime they start the program and that the setup program and main program
are completely different.  Can some one post some code to help me out?
Thanks In Advance.



Wed, 21 Jun 2000 03:00:00 GMT  
 Day Of The Week & Time Zones


>How can I find the day of the week?

See: my article on Julian Day:
"http://www.basicguru.com/zijlema/julian.htm".
--
Egbert Zijlema
http://www.basicguru.com/zijlema/
http://users.castel.nl/~zylema/


Thu, 22 Jun 2000 03:00:00 GMT  
 Day Of The Week & Time Zones

Quote:
> I'm trying to create a program that beeps at 12:00 PST on Saturdays.  It
> needs to have support for all US time zones.  I have two questions 1. How
> can I find the day of the week? I've tried using the routines in QBSUBFUN
> but it always says it's thursday (it's saturday today).

I'm too lazy right now to give you a time zone solution, but here's how to
determine the day of the week from the date.  Zeller's Congruence returns
0=Sunday, 1=Monday, ..., 6=Saturday.  Good for any year in the Gregorian
Calendar (since 1582).

'  **************************************************
'  *                                                *
'  *                  WEEKDAY.BAS                   *
'  *                                                *
'  *         Calculates Day of Week from Date       *
'  *             Using Zeller's Congruence          *
'  *                                                *
'  *              Judson D. McClendon               *
'  *              Sun Valley Systems                *
'  *              329 37th Court N.E.               *
'  *              Birmingham, AL 35215              *
'  *                 205-853-8440                   *
'  *                                                *
'  **************************************************
'
DIM M AS INTEGER, D AS INTEGER, Y AS INTEGER, W AS INTEGER

INPUT "Enter Date: MM,DD,YYYY: ", M, D, Y

IF (M < 3) THEN
   M = M + 12
   Y = Y - 1
END IF
W = ((13 * M + 3) \ 5 + D + Y + Y \ 4 - Y \ 100 + Y \ 400 + 1) MOD 7

PRINT MID$("SunMonTueWedThuFriSat", W * 3 + 1, 3)
END
--
Judson McClendon          This is a faithful saying and worthy of all
Sun Valley Systems        acceptance, that Christ Jesus came into the

(please remove zzz from email id to respond)



Thu, 22 Jun 2000 03:00:00 GMT  
 Day Of The Week & Time Zones



    You can use this to determine the day of the week.

' ***************************************************************
' DOS Service interrupt 21 Function 2Ah
' get all information regarding system date.
'
'INT 21 - DOS 1+ - GET SYSTEM DATE
'        AH = 2Ah
'RETURN: CX = year(1980 - 2099)
'      DX \ 256 = Dh = month  
'   DX AND &HFF = DL = day   (Todays Date)
'   AX AND &HFF = AL = day of week (00h=Sunday)
'****************************************************************

'$INCLUDE: 'qbx.bi'    'Use qb.bi if using QuickBasic 4.5

DIM regs AS RegType
        regs.ax = &H2A00

CALL Interrupt(&H21, regs, regs)
        year% = regs.cx
        Mth% = regs.dx \ 256
        dayno% = regs.dx AND &HFF
        wkday% = regs.ax AND &HFF

'  From: Roger Scudder    Date: 12-15-97  03:55

'**** The following code was suggested by Roger Scudder, in lieu of the
'**** lengthy SELECT CASE I initially used.

MONTHTAB$ = "JanFebMarAprMayJunJulAugSepOctNovDec"

MONTH$ = MID$(MONTHTAB$, Mth% * 3 - 2, 3)

'So...something similar for the Day of the Week.

DOW$ = "SunMonTueWedThuFriSat"
today$ = MID$(DOW$, wkday% * 3 + 1, 3)

CLS

PRINT "Year - "; year%
PRINT "Month - "; MONTH$
PRINT "Todays date - "; dayno%
PRINT "Today is a - "; today$

    I would think dealing with the Time Zone thing would be just a case
of subtracting, or adding depending on how you want to do it, to
determine whether it is 12 Noon in another time zone.


.                          La Grande, Oregon
*SignIt 2.x #001*
---
 t SPEED 2.00 #2289 t Old Programmers never die, they just lose their memory.

-----------------------------------------------------------------------------

This message was processed by Software Valley Information System
-----------------------------------------------------------------------------



Thu, 22 Jun 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Grid of days of week and time of day

2. Time & Time Zones

3. Daylight saving - winter time - summer time - time zone

4. Daylight saving - winter time - summer time - time zone

5. Daylight saving - winter time - summer time - time zone

6. Determining Time Zones or Server Time

7. Add Time zone to time received field in message

8. Time offset for Time Zone display?

9. time zones and daylight saving time

10. Formatting Time to GMT when current Time Zone not known

11. UTC time and Time Zones

12. Creating instances of dates based on days of the week

 

 
Powered by phpBB® Forum Software