回 帖 发 新 帖 刷新版面

主题:[原创]时钟(万年历的应用)源代码

飞鸟12 和 Moz 都说得好!!!!
近来QB区真是太冷清了!!!!

如果你想修改时间和日期,可以在windows中修改时间和日期
如果你想能够在程序中修改,那么你可以用TIME$和DATE$函数
对时间和日期进行修改.
一点说明:对于万年历的数据,是可以压缩到一年只有4个字节的,
         这点留给有兴趣的朋友去做,下面是万年历数据格式
         的说明:
         一年是16个字节
         每四个字节是一个Integer整数,假设是A,B,C,D
         A/256      :一年农历有几个月
         A mod 256  :农历闰年闰第几个月 0为没闰
         B/256      :农历正月初一的国历的月
         B mod 256  :农历正月初一的国历的日      
         C/256      :农历正月初一的天干
         C mod 256  :农历正月初一的地支
         D          :农历月的大小(位为1=30天,0=29天)

以下是源代码:

DECLARE SUB ClockPic (Flag%)
DECLARE SUB digMax (x%, y%, st$, size%)
DECLARE SUB ListMonth (Flag%)
DECLARE SUB ListTime (Flag%)
DECLARE SUB PalInit ()
DECLARE SUB SetPal (N%, R%, G%, B%)
DECLARE FUNCTION week% (y%, M%, d%)
DECLARE FUNCTION wnl$ (y%, M%, d%)
DECLARE SUB MyPrn (x%, y%, st$, bfclr%, bkclr%, over%)
DEFINT A-Z
'==============================================
'    取y/m/d(年/月/日)的农历(天干/地支)
'    秋风2005年10月22日
'    函数返回:wnl$(24字节)
'    byte=农历年 8 byte
'         农历月 4 byte
'         农历日 4 byte
'         日天干 4 byte
'         日地支 4 byte
'==============================================
'****************************************************************************
CONST MyClr = 15
SCREEN 12
'****************************************************************************
ON TIMER(1) GOSUB ListClock
TIMER ON
'****************************************************************************
DEF SEG = 65
WHILE INKEY$ = ""
    IF ChangeColor% = 1 AND shift% > ct% + 1 THEN
        ct% = shift%
        clr% = clr% + 1
        SetPal MyClr, clr%, clr%, clr%
        IF clr% >= 63 THEN ChangeColor% = 0
    END IF
    
    IF ChangeColor% = 2 AND shift% > ct% + 1 THEN
        ct% = shift%
        clr% = clr% - 1
        SetPal MyClr, clr%, clr%, clr%
        IF clr% <= 0 THEN ChangeColor% = 0
    END IF
    shift% = PEEK(92)
    IF ct% > shift% THEN ct% = 0
WEND
END
'****************************************************************************
ListClock:
    SELECT CASE count%
        CASE 0
             CLS : clr% = 0
             SetPal MyClr, 0, 0, 0
             CALL ClockPic(1)
             ChangeColor% = 1
        CASE 12
             ChangeColor% = 2
             clr% = 63
        CASE 20
             CLS : clr% = 0
             SetPal MyClr, 0, 0, 0
             CALL ListMonth(1)
             ChangeColor% = 1
        CASE 32
             ChangeColor% = 2
             clr% = 63
        CASE 40
             CLS : clr% = 0
             SetPal MyClr, 0, 0, 0
             CALL ListTime(1)
             ChangeColor% = 1
        CASE 52
             ChangeColor% = 2
             clr% = 63
    END SELECT
    IF count% < 20 THEN
       CALL ClockPic(0)
    END IF
    IF count% >= 40 AND count% < 60 THEN
       CALL ListTime(0)
    END IF
    count% = count% + 1
    IF count% >= 60 THEN count% = 0
RETURN

回复列表 (共9个回复)

沙发

DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,4,255,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,16,63,248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,255,254,0,0,0,0,0,0
DATA 0,0,0,8,127,252,0,0,0,0,0,0,0,16,63,248,0,0,0,0,0,0,0,0,0,4,255,254,0,0,0,0
DATA 0,0,0,4,127,254,68,68,68,68,68,68,68,68,68,68,68,68,68,60,72,4,80,4,64,4,127,252,64,4,0,0
DATA 0,0,0,8,127,252,2,0,2,0,2,0,2,16,63,252,4,16,4,16,4,16,8,16,8,16,8,20,255,254,0,0
DATA 0,0,4,0,2,0,3,0,1,4,255,254,0,0,0,0,4,64,12,32,8,16,16,24,16,12,32,12,64,4,0,0
DATA 2,0,2,0,2,0,2,0,2,0,2,4,3,254,254,0,2,0,2,0,2,0,2,4,2,4,2,4,1,252,0,0
DATA 0,0,0,64,4,64,4,64,4,64,4,64,4,64,4,64,8,32,8,32,8,32,16,16,16,8,32,14,64,4,0,0
DATA 4,0,4,0,4,0,4,32,255,240,4,32,4,32,4,32,4,32,4,32,8,32,8,32,16,34,16,34,32,30,192,0
DATA 1,0,1,0,1,0,1,0,1,0,1,4,255,254,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0
DATA 0,0,8,32,8,32,8,32,8,36,255,254,8,32,8,32,8,32,8,32,8,32,8,32,8,32,8,32,15,224,8,32
DATA 32,0,16,0,16,4,5,254,252,68,8,68,16,68,52,68,88,68,148,68,16,68,16,132,16,132,17,4,18,40,20,16
DATA 0,0,63,240,0,16,0,32,0,64,1,128,1,4,255,254,1,0,1,0,1,0,1,0,1,0,1,0,5,0,2,0
DATA 0,16,63,248,2,16,2,16,2,16,2,16,2,16,31,240,4,16,4,16,4,16,4,16,4,16,4,20,255,254,0,0
DATA 2,0,1,0,127,254,64,2,128,20,63,248,1,0,63,248,33,8,63,248,33,8,63,248,0,0,12,96,48,24,64,4
DATA 4,0,14,4,48,126,34,68,34,68,34,68,34,68,34,68,34,68,46,100,50,84,2,72,4,64,24,64,96,64,0,64
DATA 0,16,63,248,32,0,32,32,63,240,32,0,32,8,63,252,37,0,37,16,36,160,36,64,68,48,69,14,134,4,4,0
DATA 0,8,127,252,64,8,64,8,64,8,64,8,127,248,64,8,64,0,64,0,64,0,64,0,64,2,64,2,63,254,0,0
DATA 8,0,8,16,15,248,17,0,17,0,33,0,65,0,1,4,255,254,1,0,1,0,1,0,1,0,1,0,1,0,1,0
DATA 1,0,1,0,1,4,255,254,1,0,1,0,1,8,127,252,3,128,3,64,5,32,9,24,17,14,97,4,1,0,1,0
DATA 1,0,1,0,1,8,63,252,33,8,33,8,33,8,63,248,33,8,33,8,33,8,63,248,33,8,1,0,1,0,1,0
DATA 0,4,255,254,4,64,4,72,63,252,36,72,36,72,36,72,36,120,40,8,48,72,47,232,32,8,32,8,63,248,32,8
DATA 0,128,0,160,0,144,63,252,32,128,32,128,32,136,40,72,38,80,34,80,32,32,32,96,32,144,33,18,66,10,132,6
DATA 2,0,1,0,1,4,255,254,1,0,2,32,4,96,8,128,31,16,2,48,4,64,8,192,49,32,6,16,24,12,96,4
DATA 0,8,63,252,33,8,33,8,33,8,63,248,33,8,33,8,33,8,63,248,33,8,1,0,1,0,1,0,1,0,1,0
DATA 0,0,0,0,127,224,0,64,0,128,1,0,2,0,4,0,8,0,16,0,16,0,32,4,32,4,32,4,31,252,0,0
DATA 0,0,0,4,255,254,1,0,1,0,1,8,63,252,33,8,33,8,33,136,34,72,36,40,40,40,32,8,32,40,32,16
DATA 0,0,0,8,127,252,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,5,0,2,0
DATA 0,128,0,160,0,144,63,252,32,128,32,128,32,132,32,68,32,72,32,72,32,48,32,32,64,96,64,146,131,10,0,6
DATA 0,16,127,248,0,16,0,16,32,16,32,16,63,240,32,16,32,0,32,0,32,0,32,4,32,4,32,4,31,252,0,0
DATA 1,0,0,132,63,254,32,128,32,136,47,252,32,136,63,254,32,136,47,248,32,136,33,64,65,64,66,48,132,14,24,4
DATA 2,0,1,16,63,248,8,32,4,32,4,68,255,254,1,0,1,0,1,8,127,252,1,0,1,0,1,0,1,0,1,0
DATA 0,16,0,120,63,128,1,0,1,0,1,0,1,0,1,4,255,254,1,0,1,0,1,0,1,0,1,16,63,248,0,0
DATA 8,32,8,36,255,254,8,32,62,160,34,72,20,48,8,16,63,238,193,4,1,16,63,248,1,0,2,192,12,48,48,8
DATA 8,0,8,8,31,252,17,0,33,0,65,16,31,248,17,0,17,0,17,4,255,254,1,0,1,0,1,0,1,0,1,0
DATA 0,16,15,248,8,16,8,16,8,16,15,240,8,16,8,16,8,16,15,240,8,16,8,16,16,16,16,16,32,80,64,32
DATA 0,16,31,248,16,16,16,16,16,16,16,16,16,16,31,240,16,16,16,16,16,16,16,16,16,16,31,240,16,16,0,0
DATA 0,8,63,252,32,8,63,248,32,8,63,248,1,0,33,8,63,252,33,0,65,16,191,248,1,0,1,4,255,254,0,0
DATA 34,4,34,126,34,68,127,68,34,68,62,124,34,68,62,68,34,68,34,124,255,196,0,68,36,68,34,132,65,20,130,8
DATA 31,240,1,0,127,254,65,2,157,116,1,0,29,112,2,128,12,96,50,24,193,6,15,224,0,64,2,128,1,0,0,128
DATA 0,8,127,252,1,0,1,0,1,0,1,0,17,16,17,248,17,0,17,0,17,0,17,0,17,0,17,4,255,254,0,0
DATA 32,4,27,254,8,4,64,36,95,244,65,4,65,4,65,68,79,228,65,4,65,4,65,36,95,244,64,4,64,20,64,8
DATA 0,0,56,108,198,198,214,214,198,198,108,56,0,0,0,0
DATA 0,0,24,56,120,24,24,24,24,24,24,126,0,0,0,0
DATA 0,0,124,198,6,12,24,48,96,192,198,254,0,0,0,0
DATA 0,0,124,198,6,6,60,6,6,6,198,124,0,0,0,0
DATA 0,0,12,28,60,108,204,254,12,12,12,30,0,0,0,0
DATA 0,0,254,192,192,192,252,6,6,6,198,124,0,0,0,0
DATA 0,0,56,96,192,192,252,198,198,198,198,124,0,0,0,0
DATA 0,0,254,198,6,6,12,24,48,48,48,48,0,0,0,0
DATA 0,0,124,198,198,198,124,198,198,198,198,124,0,0,0,0
DATA 0,0,124,198,198,198,126,6,6,6,12,120,0,0,0,0
DATA 0,0,0,0,24,24,0,0,0,24,24,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

板凳

SUB ClockPic (Flag%)
    STATIC Hx%, Hy%
    STATIC Mx%, My%
    STATIC Sx%, Sy%
    CONST cx = 320, cy = 240
    CONST Lx = 100, Ly = 100
    '====================================================================
    t$ = TIME$   '取时间
    hour% = VAL(MID$(t$, 1, 2))
    minute% = VAL(MID$(t$, 4, 2))
    Second% = VAL(MID$(t$, 7, 2))
    '====================================================================
    IF Flag% = 1 THEN       '画时钟
        FOR i% = 0 TO 59
            IF i% MOD 5 <> 0 THEN
                angle# = ATN(1) * i% * 2 / 15
                x% = SIN(angle#) * Lx% + cx%
                y% = COS(angle#) * Ly% + cy%
                PSET (x%, y%), MyClr
            END IF
        NEXT
        N% = 6
        FOR i% = 0 TO 11
            angle# = ATN(1) * i% * 2 / 3
            x% = SIN(angle#) * Lx% + cx%
            y% = COS(angle#) * Ly% + cy%
            CIRCLE (x%, y%), 2, MyClr
            x% = SIN(angle#) * (Lx% + 13) + cx% - 4
            y% = COS(angle#) * (Ly% + 13) + cy% - 8
            IF N% = 12 THEN x% = x% - 4
            IF N% = 6 THEN x% = x% + 2
            MyPrn x%, y%, LTRIM$(STR$(N%)), MyClr, 0, 0
            N% = N% - 1
            IF N% < 1 THEN N% = 12
        NEXT
        Lc% = 1
        ELSE
        LINE (cx%, cy%)-(Hx%, Hy%), 0
        LINE (cx%, cy%)-(Mx%, My%), 0
        LINE (cx%, cy%)-(Sx%, Sy%), 0
    END IF
    
    angle# = (30 - hour% - minute% / 60 - Second% / 3600) * 2 * ATN(1) / 3
    Hx% = .7 * SIN(angle#) * Lx% + cx%
    Hy% = .7 * COS(angle#) * Ly% + cy%
    LINE (cx%, cy%)-(Hx%, Hy%), MyClr

    angle# = (30 - minute% - Second% / 60) * 2 * ATN(1) / 15
    Mx% = .85 * SIN(angle#) * Lx% + cx%
    My% = .85 * COS(angle#) * Ly% + cy%
    LINE (cx%, cy%)-(Mx%, My%), MyClr

    angle# = (30 - Second%) * 2 * ATN(1) / 15
    Sx% = .96 * SIN(angle#) * Lx% + cx%
    Sy% = .96 * COS(angle#) * Ly% + cy%
    LINE (cx%, cy%)-(Sx%, Sy%), MyClr
END SUB

SUB digMax (x%, y%, st$, size%)
    MyPrn 0, 0, st$, MyClr%, 0, 0
    FOR i% = 0 TO LEN(st$) * 8
        N% = x% + (i% * size%)
        FOR j% = 0 TO 15
            IF POINT(i%, j%) THEN
               CIRCLE (N%, y% + j% * size%), size% / 2, MyClr
            END IF
        NEXT
    NEXT
    LOCATE 1, 1: PRINT STRING$(LEN(st$), " ")
END SUB

SUB ListMonth (Flag%)
    CONST L% = 25, H% = 15
    STATIC Lc%, Ms() AS INTEGER
    COLOR MyClr
    IF Lc% = 0 THEN
        Lc% = 1: REDIM Ms(1 TO 12) AS INTEGER
        Ms(1) = 31: Ms(3) = 31: Ms(4) = 30: Ms(5) = 31: Ms(6) = 30: Ms(7) = 31
        Ms(8) = 31: Ms(9) = 30: Ms(10) = 31: Ms(11) = 30: Ms(12) = 31
    END IF
    Ms(2) = 28 - ((Year% MOD 4 = 0 AND Year% MOD 100 <> 0) OR Year% MOD 400 = 0)
    d$ = DATE$
    Year% = VAL(MID$(d$, 7, 4))
    Month% = VAL(MID$(d$, 1, 2))
    day% = VAL(MID$(d$, 4, 2))
    '=========================================
    s$ = LTRIM$(STR$(Month%))
    IF Month% < 10 THEN M% = 270 ELSE M% = 240
    CALL digMax(M%, 90, s$, 8)
    '***********************************************************************
    MyPrn L% * 8, H% * 16 - 40, "日  一  二  三  四  五  六", MyClr, 0, 0
    M% = week(Year%, Month%, 1)
    y% = M% * 4 + L%
    x% = H%
    FOR i% = 1 TO Ms(Month%)
        IF i% < 10 THEN
            MyPrn y% * 8 + 8, x% * 16 - 16, LTRIM$(STR$(i%)), MyClr, 0, 0
        ELSE
            MyPrn y% * 8, x% * 16 - 16, LTRIM$(STR$(i%)), MyClr, 0, 0
        END IF
        y% = y% + 4
        IF y% > L% + 24 THEN x% = x% + 1: y% = L%
    NEXT
    x% = (M% + day% - 1) MOD 7
    x% = (x% * 4 + L%) * 8 + 7
    y% = INT((M% + day% - 1) / 7)
    y% = (y% + H% - 1) * 16 + 7
    CIRCLE (x%, y%), 15, MyClr, , , .5
END SUB

3 楼

SUB ListTime (Flag%)
    CONST hz$ = "日一二三四五六"
    IF Flag% = 1 THEN
        d$ = DATE$
        Year% = VAL(MID$(d$, 7, 4))
        Month% = VAL(MID$(d$, 1, 2))
        day% = VAL(MID$(d$, 4, 2))
        w% = week(Year%, Month%, day%)
        digMax 230, 130, "星期" + MID$(hz$, w% * 2 + 1, 2), 4
        t$ = wnl(Year%, Month%, day%)
        MyPrn 200, 300, MID$(t$, 1, 8) + MID$(t$, 17, 4) + "年" + MID$(t$, 9, 4) + "月" + MID$(t$, 13, 4) +

MID$(t$, 21, 4) + "日", MyClr, 0, 0
    END IF
    MyPrn 290, 240, TIME$, MyClr, 0, 1
END SUB

SUB MyPrn (x%, y%, st$, bfclr%, bkclr%, over%)
    CONST hz$ = "一二三四五六七八九十廿初子丑寅卯辰巳午末申酉戍亥甲乙丙丁戊已庚辛壬葵年月日星期零正闰"
    CONST dig$ = "0123456789: "
    Slen% = LEN(st$)
    '************************************************************************
    STATIC Lc%
    STATIC H() AS INTEGER, d() AS INTEGER
    IF Lc% = 0 THEN
         Lc% = 1: N% = LEN(hz$) / 2
         REDIM H(N%, 32) AS INTEGER, d(12, 16) AS INTEGER
         FOR i% = 0 TO N% - 1
             FOR j% = 0 TO 31
                 READ H(i%, j%)
             NEXT
         NEXT
         FOR i% = 0 TO 11
             FOR j% = 0 TO 15
                 READ d(i%, j%)
             NEXT
         NEXT
    END IF
    '************************************************************************
    IF over% <> 0 THEN LINE (x%, y%)-(x% + Slen% * 8, y% + 16), bkclr%, BF
    rx% = x%: N% = 1
    WHILE N% <= Slen%
         bit% = INSTR(dig$, MID$(st$, N%, 1))
         IF bit% THEN
              bit% = bit% - 1
              FOR i% = 0 TO 15
                     LINE (rx%, y% + i%)-(rx% + 7, y% + i%), bfclr%, B, d(bit%, i%)
              NEXT
         ELSE
              bit% = (INSTR(hz$, MID$(st$, N%, 2)) - 1) / 2
              FOR i% = 0 TO 15
                   LINE (rx%, y% + i%)-(rx% + 7, y% + i%), bfclr%, B, H(bit%, i% + i%)
                   LINE (rx% + 8, y% + i%)-(rx% + 15, y% + i%), bfclr%, B, H(bit%, i% + i% + 1)
              NEXT
              N% = N% + 1: rx% = rx% + 8
         END IF
         N% = N% + 1: rx% = rx% + 8
    WEND
END SUB

SUB SetPal (N%, R%, G%, B%)
    OUT &H3C6, 255
    OUT &H3C8, N%
    OUT &H3C9, R%
    OUT &H3C9, G%
    OUT &H3C9, B%
END SUB

FUNCTION week% (y%, M%, d%)
IF y% < 1900 OR y% > 2049 THEN EXIT FUNCTION
    STATIC Lc%, Ms() AS INTEGER
    IF Lc% = 0 THEN
        Lc% = 1: REDIM Ms(1 TO 12) AS INTEGER
        Ms(1) = 31: Ms(3) = 31: Ms(4) = 30: Ms(5) = 31: Ms(6) = 30: Ms(7) = 31
        Ms(8) = 31: Ms(9) = 30: Ms(10) = 31: Ms(11) = 30: Ms(12) = 31
    END IF
    FOR i% = 1900 TO y% - 1
        day& = day& + 365 - ((y% MOD 4 = 0 AND y% MOD 100 <> 0) OR y% MOD 400 = 0)
    NEXT
    Ms(2) = 28 - ((y% MOD 4 = 0 AND y% MOD 100 <> 0) OR y% MOD 400 = 0)
    FOR i% = 1 TO M% - 1
       day& = day& + Ms(i%)
    NEXT
    week% = (day& + d% + 5) MOD 7
END FUNCTION

4 楼

FUNCTION wnl$ (y%, M%, d%)
IF y% > 2049 OR y% < 1920 THEN EXIT FUNCTION
    CONST Daystr$ = "初一初二初三初四初五初六初七初八初九初十十一十二十三十四十五十六十七十八十九二十廿一廿二

廿三廿四廿五廿六廿七廿八廿九三十"
    CONST DigStr$ = "零一二三四五六七八九"
    CONST Monthstr$ = "  正  二  三  四  五  六  七  八  九  十十一十二"
    CONST tgstr$ = "癸甲乙丙丁戊己庚辛壬", dzstr$ = "亥子丑寅卯辰巳午末申酉戍"
    STATIC Lc AS INTEGER, w() AS INTEGER, Ms() AS INTEGER
    DIM L AS STRING * 24
    '=======================================================================
    IF Lc% = 0 THEN        
        dt$ = dt$ + "307205321289373030720520230733653333028407776733"
        dt$ = dt$ + "307205281801264630720517025906943332028012895557"
        dt$ = dt$ + "307205252570174830720514102837533330027923157826"
        dt$ = dt$ + "307205220779373033340286179733663072052925641323"
        dt$ = dt$ + "307205181034264733330282230947903072052607732906"
        dt$ = dt$ + "307205162060174833310280051837853072052315421865"
        dt$ = dt$ + "333502872572577930720531103627073072052020541323"
        dt$ = dt$ + "333402830524265130720527154827333072051702631386"
        dt$ = dt$ + "333202811281699730720525256229803072051410322889"
        dt$ = dt$ + "333002782050680330720522051427093335028515445421"
        dt$ = dt$ + "307205292568133430720518102627333333028323135546"
        dt$ = dt$ + "307205260777145830720515179534933331028005227498"
        dt$ = dt$ + "307205241546340233360287256427093072053007712711"
        dt$ = dt$ + "307205202058136633340284051627413072052715402773"
        dt$ = dt$ + "307205170267174633320281128537493072052523093749"
        dt$ = dt$ + "307205141036161033310277179732233072052102612715"
        dt$ = dt$ + "333502861548546630720529308413863072051810302921"
        dt$ = dt$ + "333302832305597030720527076928983072051517992853"
        dt$ = dt$ + "333202790257570730720523128126353336028723115291"
        dt$ = dt$ + "307205300775068530720519179313893334028405202921"
        dt$ = dt$ + "307205181544349730720517025934743332028112897461"
        dt$ = dt$ + "307205252313336533380514077167333072053217952646"
        dt$ = dt$ + "307205210265069433340285128314613072052923071749"
        dt$ = dt$ + "307205181034375333330283230978263072052707733730"
        dt$ = dt$ + "307205161803336633310279026126463072052210282647"
        dt$ = dt$ + "333602872315533430720531077908583072051917971749"
        dt$ = dt$ + "333302840524583330720528154818653072051725661683"
        dt$ = dt$ + "333202801036541930720524206013233072051305182651"
        dt$ = dt$ + "333002781793546630720521025713863335028512876997"
        dt$ = dt$ + "307205302568298030720519102628893333028220566803"
        dt$ = dt$ + "307205260520270930720515153813253332027925682733"
        dt$ = dt$ + "307205221032273333370287230755463072053107711490"
        dt$ = dt$ + "307205201801349333340284051674983072052815403402"
        dt$ = dt$ + "307205172570322133320281102854223072052420521366"
        dt$ = dt$ + "307205130522274133300278179755543072052202611746"
        dt$ = dt$ + "333402851291375330720529231518293072051807731611"
        dt$ = dt$ + "333302821803322330720525026732433072051515421370"
        dt$ = dt$ + "333102792572277430720523103629213335028723115970"
        dt$ = dt$ + "307205310775289830720520179328533334028402636731"
        dt$ = dt$ + "307205271287263530720516230511953333028007751371"
        dt$ = dt$ + "307205241799145330720513051429223330027818016994"
        dt$ = dt$ + "307205220265347433350286128374613072052923073365"
        dt$ = dt$ + "307205180777264533330282179552933072052602591206"
        dt$ = dt$ + "307205141289146133310279256434980209001900000000"

5 楼

Lc% = 1: REDIM w(1920 TO 2049, 7) AS INTEGER, Ms(1 TO 12) AS INTEGER
        Ms(1) = 31: Ms(3) = 31: Ms(4) = 30: Ms(5) = 31: Ms(6) = 30: Ms(7) = 31
        Ms(8) = 31: Ms(9) = 30: Ms(10) = 31: Ms(11) = 30: Ms(12) = 31
        FOR i% = 1920 TO 2049
            p$ = MID$(dt$, (i% - 1920) * 16 + 1, 16)
            N% = VAL(MID$(p$, 1, 4))
            w(i%, 0) = INT(N% / 256)             '0几个月
            w(i%, 1) = N% MOD 256                '1闰几月
            N% = VAL(MID$(p$, 5, 4))
            w(i%, 2) = INT(N% / 256)             '2初一的国历月
            w(i%, 3) = N% MOD 256                '3初一的国历日
            N% = VAL(MID$(p$, 9, 4))
            w(i%, 4) = INT(N% / 256)             '4初一的农历天干
            w(i%, 5) = N% MOD 256                '5初一的农历地支
            w(i%, 6) = VAL(MID$(p$, 13, 4))      '6农历月大小
        NEXT
        dt$ = ""
    END IF
    '=======================================================================
    '取自农历正月初一到(y/m/d)的天数
    IF M% < w(y%, 2) OR (M% = w(y%, 2) AND d% < w(y%, 3)) THEN
        vy% = y% - 1
        ELSE : vy% = y%
    END IF
    Ms(2) = 28 - ((y% MOD 4 = 0 AND y% MOD 100 <> 0) OR y% MOD 400 = 0)
    IF vy% = y% THEN
        FOR i% = w(y%, 2) TO M% - 1
            day% = day% + Ms(i%)
        NEXT
        day% = day% + d% - w(y%, 3)
    ELSE
        FOR i% = 1 TO M% - 1
            day% = day% + Ms(i%)
        NEXT
        Ms(2) = 28 - ((vy% MOD 4 = 0 AND vy% MOD 100 <> 0) OR vy% MOD 400 = 0)
        FOR i% = w(vy%, 2) TO 12
            day% = day% + Ms(i%)
        NEXT
        day% = day% + d% - w(vy%, 3)
    END IF
    '=======================================================================
    '***********************************************************************
    '以下是最终获得各数据
    '年/月/日
    N% = vy%
    FOR i% = 3 TO 0 STEP -1
        MID$(L$, i% * 2 + 1, 2) = MID$(DigStr$, (N% MOD 10) * 2 + 1, 2)
        N% = INT(N% / 10)
    NEXT
    t% = day%: N% = 1
    WHILE t% > 0
        IF w(vy%, 6) AND N% THEN div% = 30 ELSE div% = 29
        N% = N% + N%: t% = t% - div%
        vm% = vm% + 1
    WEND
    vd% = t%
    IF vd% < 0 THEN
        vd% = vd% + div%: vm% = vm% - 1
    END IF
    IF w(vy%, 1) THEN    '有闰
            IF vm% < w(vy%, 1) THEN
                MID$(L$, 9, 4) = MID$(Monthstr$, vm% * 4 + 1, 4)
                ELSE
                MID$(L$, 9, 4) = MID$(Monthstr$, (vm% - 1) * 4 + 1, 4)
            END IF
            IF vm% = w(vy%, 1) THEN MID$(L$, 9, 2) = "闰"
        ELSE
            MID$(L$, 9, 4) = MID$(Monthstr$, vm% * 4 + 1, 4)
    END IF
    MID$(L$, 13, 4) = MID$(Daystr$, vd% * 4 + 1, 4)
    '***********************************************************************
    '以下获得天干/地支
    G% = (vy% + 7) MOD 10: z% = (vy% + 9) MOD 12
    MID$(L$, 17, 4) = MID$(tgstr$, G% * 2 + 1, 2) + MID$(dzstr$, z% * 2 + 1, 2)
    G% = (day% + w(vy%, 4)) MOD 10: z% = (day% + w(vy%, 5)) MOD 12
    MID$(L$, 21, 4) = MID$(tgstr$, G% * 2 + 1, 2) + MID$(dzstr$, z% * 2 + 1, 2)
    wnl$ = L$
    EXIT FUNCTION
END FUNCTION

6 楼

想问一下,阴历1987年8月20日是阴历几月几日
轻各位美女帅哥帮帮忙

7 楼

阴历1987年8月20日就是阴历八月二十日

还有我可以严肃的告诉你
你父母是骗你的,
你的生日根本不是闰六月廿十六

8 楼

xiang gao shou zhi jing

9 楼

嚮高手緻敬,剛才打不処漢字!

我来回复

您尚未登录,请登录后再回复。点此登录或注册