Guidance
指路人
g.yi.org
software / rapidq / Examples / Date & Time / day of week.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'From: jonaju0945  Sep 10th, 2002, 8:36pm

'Program Day-Of-Week or d-o-w
'this formula calculate the d-o-w for windos/unix programs
'hope help you out

     FUNCTION dow$(d$ AS STRING) AS STRING
      DIM a AS INTEGER
      DIM y AS INTEGER
      DIM m AS INTEGER
      DIM DOW AS INTEGER
      DIM dd$ AS STRING

      dd$="SunMonTueWedThuFriSat"
      a = (14 - VAL(MID$(d$,1,2))) / 12 : y = VAL(MID$(d$,7,4)) - a
      m = VAL(MID$(d$,1,2)) + 12 * (a - 2)
      dow = (VAL(MID$(d$,4,2)) + y + y/4 - y/100 + y/400 + (31 * m)/12) MOD 7
      dow$=MID$(dd$,(dow*3)+1,3)
     END FUNCTION

     FUNCTION dow(d$ AS STRING) AS INTEGER
      DIM a AS INTEGER
      DIM y AS INTEGER
      DIM m AS INTEGER
      DIM dd AS INTEGER

      a = (14 - VAL(MID$(d$,1,2))) / 12 : y = VAL(MID$(d$,7,4)) - a
      m = VAL(MID$(d$,1,2)) + 12 * (a - 2)
      dow = (VAL(MID$(d$,4,2)) + y + y/4 - y/100 + y/400 + (31 * m)/12) MOD 7
     END FUNCTION

     D$ = dow$(DATE$) 'return d-o-w in 3 letters format
     D% = dow(DATE$) 'return d-o-w in numbers 0=Sun
     SHOWMESSAGE d$+" - "+STR$(d%)
掌柜推荐
 
 
¥477.00 ·
 
 
¥918.00 ·
 
 
¥370.00 ·
 
 
¥271.00 ·
 
 
¥995.00 ·
 
 
¥1,580.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2002-09-11 18:25:40