欢迎来到皮皮网网首页

【趋势买卖点指标源码】【虚拟直播软件源码】【金钻石指标源码】vb 源码 农历

来源:罗盘桌面源码 时间:2024-11-23 19:25:26

1.VB农历的源码计算方法
2.vb算农历
3.用VB如何做万年历

vb 源码 农历

VB农历的计算方法

       下面是关于VB农历计算方法的基本说明。具体应用时,农历请根据实际情况进行适当的源码修改和补充。

       1. 日期数据定义方法如下:前个字节代表1-月为大月或是农历小月,1为大月天,源码趋势买卖点指标源码0为小月天。农历虚拟直播软件源码第位为闰月的源码情况,1为大月天,农历0为小月天。源码第位为闰年,农历如果不是源码闰月为0,否则给出月份,农历、源码金钻石指标源码、农历分别用A、源码B、C来表示,区块互助源码fastadmin即使用进制。最后4位为当年农历新年,即农历1月1日所在公历的日期,如代表1月日。Yggdrasil论坛系统源码

       2. GetYLDate函数使用方式如下:tYear为要输入的年,tMonth为月,tDay为日期。YLyear是返回值,返加农历的年份,如甲子年。YLShuXing是返回值,返回的是生肖,如鼠。IsGetGl是设置是不是通过农历取公历值,如果是,前三个返回相应的公历日期。

       3. 以下是一个关于如何使用GetYLDate函数的例子:

       ```vb

       Private Sub Command1_Click()

        Dim ty As Integer, tm As Integer, td As Integer, yl As String, sx As String

        '取公历年月日的农历日期

        ty =

        tm =

        td =

        '调用GetYLDate函数

        t = GetYLDate(ty, tm, td, yl, sx)

        MsgBox t

        MsgBox ty & "-" & tm & "-" & td & " " & yl & " " & sx

        '取年农历十月的公历日期

        t = GetYLDate(ty, tm, td, yl, sx, True)

        MsgBox t

        MsgBox ty & "-" & tm & "-" & td & " " & yl & " " & sx

       End Sub

       ```

       请注意,以上代码仅为示例,具体实现时可能需要进行相应的调整和优化。

vb算农历

       ç½‘上也有代码的。以下是我修改过的,没有注释

       Dim WeekName(7), MonthAdd(), NongliData(), TianGan(9), DiZhi(), ShuXiang(), DayName(), MonName()

       Dim curTime, curYear, curMonth, curDay, curWeekday

       Dim GongliStr, WeekdayStr, NongliStr, NongliMonStr, NongliDayStr

       Dim i, m, n, k, isEnd, bit, TheDate

        Public Function wYear(curTime As Date, YearOrDay As Integer)

        'curTime是传递需要转化的日期,YearOrDay是需要输出什么结果

        ' YearOrDay的值是 0=年月日,1=仅农历年,2=仅月日,3=农历节日

        ' 4=仅月,5=仅日

        '获取当前系统时间

        'curTime = CDate("-4-")

        '星期名

        WeekName(0) = " * "

        WeekName(1) = "星期日"

        WeekName(2) = "星期一"

        WeekName(3) = "星期二"

        WeekName(4) = "星期三"

        WeekName(5) = "星期四"

        WeekName(6) = "星期五"

        WeekName(7) = "星期六"

        '天干名称

        TianGan(0) = "甲"

        TianGan(1) = "乙"

        TianGan(2) = "丙"

        TianGan(3) = "丁"

        TianGan(4) = "戊"

        TianGan(5) = "å·±"

        TianGan(6) = "庚"

        TianGan(7) = "辛"

        TianGan(8) = "壬"

        TianGan(9) = "癸"

        '地支名称

        DiZhi(0) = "子"

        DiZhi(1) = "丑"

        DiZhi(2) = "寅"

        DiZhi(3) = "卯"

        DiZhi(4) = "è¾°"

        DiZhi(5) = "å·³"

        DiZhi(6) = "午"

        DiZhi(7) = "未"

        DiZhi(8) = "申"

        DiZhi(9) = "酉"

        DiZhi() = "戌"

        DiZhi() = "亥"

        '属相名称

        ShuXiang(0) = "é¼ "

        ShuXiang(1) = "牛"

        ShuXiang(2) = "虎"

        ShuXiang(3) = "兔"

        ShuXiang(4) = "龙"

        ShuXiang(5) = "蛇"

        ShuXiang(6) = "马"

        ShuXiang(7) = "羊"

        ShuXiang(8) = "猴"

        ShuXiang(9) = "鸡"

        ShuXiang() = "狗"

        ShuXiang() = "猪"

        '农历日期名

        DayName(0) = "*"

        DayName(1) = "初一"

        DayName(2) = "初二"

        DayName(3) = "初三"

        DayName(4) = "初四"

        DayName(5) = "初五"

        DayName(6) = "初六"

        DayName(7) = "初七"

        DayName(8) = "初八"

        DayName(9) = "初九"

        DayName() = "初十"

        DayName() = "十一"

        DayName() = "十二"

        DayName() = "十三"

        DayName() = "十四"

        DayName() = "十五"

        DayName() = "十六"

        DayName() = "十七"

        DayName() = "十八"

        DayName() = "十九"

        DayName() = "二十"

        DayName() = "廿一"

        DayName() = "廿二"

        DayName() = "廿三"

        DayName() = "廿四"

        DayName() = "廿五"

        DayName() = "廿六"

        DayName() = "廿七"

        DayName() = "廿八"

        DayName() = "廿九"

        DayName() = "三十"

        '农历月份名

        MonName(0) = "*"

        MonName(1) = "æ­£"

        MonName(2) = "二"

        MonName(3) = "三"

        MonName(4) = "四"

        MonName(5) = "五"

        MonName(6) = "六"

        MonName(7) = "七"

        MonName(8) = "八"

        MonName(9) = "九"

        MonName() = "十"

        MonName() = "十一"

        MonName() = "腊"

        '公历每月前面的天数

        MonthAdd(0) = 0

        MonthAdd(1) =

        MonthAdd(2) =

        MonthAdd(3) =

        MonthAdd(4) =

        MonthAdd(5) =

        MonthAdd(6) =

        MonthAdd(7) =

        MonthAdd(8) =

        MonthAdd(9) =

        MonthAdd() =

        MonthAdd() =

        '农历数据

        NongliData(0) =

        NongliData(1) =

        NongliData(2) =

        NongliData(3) =

        NongliData(4) =

        NongliData(5) =

        NongliData(6) =

        NongliData(7) =

        NongliData(8) =

        NongliData(9) =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        NongliData() =

        '生成当前公历年、月、日 ==> GongliStr

        curYear = Year(curTime)

        curMonth = Month(curTime)

        curDay = Day(curTime)

        GongliStr = curYear & "å¹´"

        If (curMonth < ) Then

        GongliStr = GongliStr & "0" & curMonth & "月"

        Else

        GongliStr = GongliStr & curMonth & "月"

        End If

        If (curDay < ) Then

        GongliStr = GongliStr & "0" & curDay & "日"

        Else

        GongliStr = GongliStr & curDay & "日"

        End If

        '生成当前公历星期 ==> WeekdayStr

        curWeekday = Weekday(curTime)

        WeekdayStr = WeekName(curWeekday)

        '计算到初始时间年2月8日的天数:-2-8(正月初一)

        TheDate = (curYear - ) * + Int((curYear - ) / 4) + curDay + MonthAdd(curMonth - 1) -

        If ((curYear Mod 4) = 0 And curMonth > 2) Then

        TheDate = TheDate + 1

        End If

        '计算农历天干、地支、月、日

        isEnd = 0

        m = 0

        Do

        If (NongliData(m) < ) Then

        k =

        Else

        k =

        End If

        n = k

        Do

        If (n < 0) Then

        Exit Do

        End If

        '获取NongliData(m)的第n个二进制位的值

        bit = NongliData(m)

        For i = 1 To n Step 1

        bit = Int(bit / 2)

        Next

        bit = bit Mod 2

       If (TheDate <= + bit) Then

        isEnd = 1

        Exit Do

        End If

        TheDate = TheDate - - bit

        n = n - 1

        Loop

        If (isEnd = 1) Then

        Exit Do

        End If

        m = m + 1

        Loop

        curYear = + m

        curMonth = k - n + 1

        curDay = TheDate

        If (k = ) Then

        If (curMonth = (Int(NongliData(m) / ) + 1)) Then

        curMonth = 1 - curMonth

        ElseIf (curMonth > (Int(NongliData(m) / ) + 1)) Then

        curMonth = curMonth - 1

        End If

        End If

        '生成农历天干、地支、属相 ==> NongliStr

        NongliStr = TianGan(((curYear - 4) Mod ) Mod ) & DiZhi(((curYear - 4) Mod ) Mod ) & "å¹´"

        NongliStr = NongliStr & "(" & ShuXiang(((curYear - 4) Mod ) Mod ) & ")"

        'NongliStr = "农历" & NongliStr NongliStr是农历的年

        '生成农历月、日 ==> NongliDayStr

        If (curMonth < 1) Then

        NongliDayStr = "闰" & MonName(-1 * curMonth)

        Else

        NongliDayStr = MonName(curMonth)

        End If

        NongliMonStr = NongliDayStr & "月"

        NongliDayStr = DayName(curDay) 'NongliDayStr就是月日

        'GongliStr = "公历" & GongliStr '这里是公历日期

        'wyear = NongliStr & NongliDayStr & vbCrLf & GongliStr

        'wyear = NongliStr & NongliDayStr

        Select Case YearOrDay

        Case 0

        wYear = NongliStr & NongliMonStr & NongliDayStr

        Case 1

        wYear = NongliStr

        Case 2

        wYear = NongliMonStr & NongliDayStr

        Case 3

        Select Case NongliMonStr & NongliDayStr

        Case "正月初一", "闰正月初一"

        wYear = "春节"

        Case "正月十五", "闰正月十五"

        wYear = "元宵节"

        Case "五月初五", "闰五月初五"

        wYear = "端午节"

        Case "七月初七", "闰七月初七"

        wYear = "七夕节"

        Case "七月十五", "闰七月十五"

        wYear = "中元节"

        Case "八月十五", "闰八月十五"

        wYear = "中秋节"

        Case "九月初九", "闰九月初九"

        wYear = "重阳节"

        Case "腊月初八", "闰腊月初八"

        wYear = "腊八节"

        Case "腊月廿三", "闰腊月廿三"

        wYear = "小年"

        Case "腊月三十", "闰腊月三十"

        wYear = "除夕"

        Case Else

        wYear = ""

        End Select

        Case 4

        wYear = NongliMonStr

        Case 5

        wYear = NongliDayStr

        End Select

        End Function

       Function sGongliJieri(sD As Date)

       Dim sJieriDay(), sJieriName()

       sJieriDay(0) = ""

       sJieriDay(1) = ""

       sJieriDay(2) = ""

       sJieriDay(3) = ""

       sJieriDay(4) = ""

       sJieriDay(5) = ""

       sJieriDay(6) = ""

       sJieriDay(7) = ""

       sJieriDay(8) = ""

       sJieriDay(9) = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriDay() = ""

       sJieriName(0) = ""

       sJieriName(1) = "元旦节"

       sJieriName(2) = "世界湿地日"

       sJieriName(3) = "国际气象节"

       sJieriName(4) = "情人节"

       sJieriName(5) = "国际海豹日"

       sJieriName(6) = "全国爱耳日"

       sJieriName(7) = "学雷锋纪念日"

       sJieriName(8) = "妇女节"

       sJieriName(9) = "植树节,孙中山逝世纪念日"

       sJieriName() = "国际警察日"

       sJieriName() = "消费者权益日"

       sJieriName() = "中国国医节,国际航海日"

       sJieriName() = "世界森林日,消除种族歧视国际日,世界儿歌日"

       sJieriName() = "世界水日"

       sJieriName() = "世界气象日"

       sJieriName() = "世界防治结核病日"

       sJieriName() = "全国中小学生安全教育日"

       sJieriName() = "巴勒斯坦国土日"

       sJieriName() = "愚人节"

       sJieriName() = "世界卫生日"

       sJieriName() = "世界地球日"

       sJieriName() = "世界图书和版权日"

       sJieriName() = "亚非新闻工作者日"

       sJieriName() = "劳动节"

       sJieriName() = "青年节"

       sJieriName() = "碘缺乏病防治日"

       sJieriName() = "世界红十字日"

       sJieriName() = "国际护士节"

       sJieriName() = "国际家庭日"

       sJieriName() = "国际电信日"

       sJieriName() = "国际博物馆日"

       sJieriName() = "全国学生营养日"

       sJieriName() = "国际牛奶日"

       sJieriName() = "世界无烟日"

       sJieriName() = "国际儿童节"

       sJieriName() = "世界环境保护日"

       sJieriName() = "全国爱眼日"

       sJieriName() = "防治荒漠化和干旱日"

       sJieriName() = "国际奥林匹克日"

       sJieriName() = "全国土地日"

       sJieriName() = "国际禁毒日"

       sJieriName() = "香港回归纪念日,中共诞辰,世界建筑日"

       sJieriName() = "国际体育记者日"

       sJieriName() = "抗日战争纪念日"

       sJieriName() = "世界人口日"

       sJieriName() = "非洲妇女日"

       sJieriName() = "建军节"

       sJieriName() = "中国男子节(爸爸节)"

       sJieriName() = "抗日战争胜利纪念"

       sJieriName() = "国际扫盲日,国际新闻工作者日"

       sJieriName() = "毛泽东逝世纪念"

       sJieriName() = "中国教师节"

       sJieriName() = "世界清洁地球日"

       sJieriName() = "国际臭氧层保护日"

       sJieriName() = "九一八事变纪念日"

       sJieriName() = "国际爱牙日"

       sJieriName() = "世界旅游日"

       sJieriName() = "孔子诞辰"

       sJieriName() = "国庆节音乐日,老人节"

       sJieriName() = "和平与民主自由斗争日"

       sJieriName() = "国庆节假日"

       sJieriName() = "世界动物日"

       sJieriName() = "老人节"

       sJieriName() = "全国高血压日,世界视觉日"

       sJieriName() = "世界邮政日,万国邮联日"

       sJieriName() = "辛亥革命纪念日,世界精神卫生日"

       sJieriName() = "世界保健日,国际教师节"

       sJieriName() = "世界标准日"

       sJieriName() = "国际盲人节(白手杖节)"

       sJieriName() = "世界粮食日"

       sJieriName() = "世界消除贫困日"

       sJieriName() = "世界传统医药日"

       sJieriName() = "联合国日"

       sJieriName() = "世界勤俭日"

       sJieriName() = "十月社会主义革命纪念日"

       sJieriName() = "中国记者日"

       sJieriName() = "全国消防安全宣传教育日"

       sJieriName() = "世界青年节"

       sJieriName() = "国际科学与和平周(本日所属的一周)"

       sJieriName() = "孙中山诞辰纪念日"

       sJieriName() = "世界糖尿病日"

       sJieriName() = "国际大学生节,世界学生节"

       sJieriName() = "彝族年"

       sJieriName() = "世界问候日,世界电视日"

       sJieriName() = "彝族年"

       sJieriName() = "国际声援巴勒斯坦人民国际日"

       sJieriName() = "世界艾滋病日"

       sJieriName() = "世界残疾人日"

       sJieriName() = "国际经济和社会发展志愿人员日"

       sJieriName() = "国际儿童电视日"

       sJieriName() = "世界足球日"

       sJieriName() = "世界人权日"

       sJieriName() = "西安事变纪念日"

       sJieriName() = "南京大屠杀纪念日"

       sJieriName() = "澳门回归纪念"

       sJieriName() = "国际篮球日"

       sJieriName() = "平安夜"

       sJieriName() = "圣诞节"

       sJieriName() = "毛泽东诞辰纪念"

       For i = 1 To

        sJieriDay1 = Left(sJieriDay(i), 2) & "-" & Right(sJieriDay(i), 2)

        nDay = CInt(CDate(sJieriDay1 & "-" & Year(sD)) - CDate(Month(sD) & "-" & Day(sD) & "-" & Year(sD)))

        If nDay = 0 Then

        sGongliJieri = "今天" & sJieriName(i)

        Exit Function

        ElseIf nDay > 0 Then

        sGongliJieri = "å·®" & nDay & "天" & sJieriName(i)

        Exit Function

        End If

       Next

       End Function

用VB如何做万年历

       ç”¨VB做万年历,非常关键点就是农历写法,参考代码如下:

       #Region " 返回农历 "

       '返回农历

       'cCalendar.返回支持的最大日期,即-1-

       'cCalendar.返回支持的最小日期,即-2-

       Private cCalendar As New System..

       Public Function PubFunGet_CNDate(ByVal sDateTime As Date) As String

       cCalendar = New System..

       Dim lyear As Integer = cCalendar.GetYear(sDateTime)

       Dim lmonth As Integer = cCalendar.GetMonth(sDateTime)

       Dim lday As Integer = cCalendar.(sDateTime)

       Dim lweek As Integer = cCalendar.(sDateTime)

       '获取闰月, 0 则表示没有闰月

       Dim leapMonth As Integer = cCalendar.(lyear)

       Dim isleap As Boolean = False

       If (leapMonth > 0) Then

       If (leapMonth = lmonth) Then

       '闰月

       isleap = True

       lmonth = lmonth - 1

       ElseIf (lmonth > leapMonth) Then

       lmonth = lmonth - 1

       End If

       End If

       Return String.Concat((lyear), IIf(isleap = True, "闰年", "å¹´"), (lmonth), "月", (lday))

       End Function

       '十天干

       Private tiangan As String() = { "甲", "乙", "丙", "丁", "戊", "å·±", "庚", "辛", "壬", "癸"}

       '十二地支

       Private di As String() = { "子", "丑", "寅", "卯", "è¾°", "å·³", "午", "未", "申", "酉", "戌", "亥"}

       '十二生肖

       Private shengxiao As String() = { "é¼ ", "牛", "虎", "免", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"}

       '农历月

       Private months As String() = { "æ­£", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二(腊)"}

       '农历日

       Private days1 As String() = { "初", "十", "廿", "三"}

       Private days As String() = { "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"}

       '返回农历年(天干 地支 生肖)

       Private Function (ByVal year As Integer) As String

       = ""

       If (year > 3) Then

       Dim tgIndex As Integer = (year - 4) Mod

       Dim dzIndex As Integer = (year - 4) Mod

       Return tiangan(tgIndex) & di(dzIndex) & "[" & shengxiao(dzIndex) & "]"

       End If

       '无效的年份!

       End Function

       '返回生肖

       Private Function (ByVal sDateTime As Date) As String

       Return shengxiao(cCalendar.(cCalendar.GetSexagenaryYear(sDateTime)) - 1)

       End Function

       '返回农历月

       Private Function GetLunisolarMonth(ByVal month As Integer) As String

       GetLunisolarMonth = ""

       If (month 0) Then

       Return months(month - 1)

       End If

       '无效的月份!

       End Function

       '返回农历日

       Private Function GetLunisolarDay(ByVal day As Integer) As String

       GetLunisolarDay = ""

       If (day > 0 AndAlso day

       If (day AndAlso day ) Then

       Return String.Concat(days1((day - 1) \ ), days((day - 1) Mod ))

       Else

       Return String.Concat(days((day - 1) \ ), days1(1))

       End If

       End If

       '无效的日!

       End Function

       #End Region