日期:2011-05-26 浏览次数:20856 次
新建模块,复制下面两个函数. glgetnl(),strnl()
在查询中使用: select glgetnl(born) as nlborn from empolyee where glgetnl(born)>"05012" order by glgetnl(born)
上面的查询返回农历生日大于五月十二员工列表,并按农历生日排序.
(声明:这两个函数不是从零开始写的,是修改了网上不知道谁的程序代码而来的.
到google输入关键字vb 农历可以找到这篇文章的多处引用
本来是想在ASP中直接调用的,后来想到放到数据库中,但在Access中可以使用,在ASP中使用ADO无法调用.在调试中发现原数据中的1998农历闰月为小月而不是原代码中的大月,另修改了求干支算法.也没去和原作者联系,见谅.)
'输入date, 返回"mmlddyyyy" mm: 月份; l: 1,闰月,0,平常月; dd: 日; yyyy年份
Function glgetnl(ByVal gldate)
Dim daList(111)
'1900 to 1909
daList(0) = "010010110110180131"
daList(1) = "010010101110000219"
daList(2) = "101001010111000208"
daList(3) = "010100100110150129"
daList(4) = "110100100110000216"
daList(5) = "110110010101000204"
daList(6) = "011010101010140125"
daList(7) = "010101101010000213"
daList(8) = "100110101101000202"
daList(9) = "010010101110120122"
daList(10) = "010010101110000210"
daList(11) = "101001001101160130"
daList(12) = "101001001101000218"
daList(13) = "110100100101000206"
daList(14) = "110101010100150126"
daList(15) = "101101010101000214"
daList(16) = "010101101010000204"
daList(17) = "100101101101020123"
daList(18) = "100101011011000211"
daList(19) = "010010011011170201"
daList(20) = "010010011011000220"
daList(21) = "101001001011000208"
daList(22) = "101100100101150128"
daList(23) = "011010100101000216"
daList(24) = "011011010100000205"
daList(25) = "101011011010140124"
daList(26) = "001010110110000213"
daList(27) = "100101010111000202"
daList(28) = "010010010111120123"
daList(29) = "010010010111000210"
daList(30) = "011001001011060130"
daList(31) = "110101001010000217"
daList(32) = "111010100101000206"
daList(33) = "011011010100150126"
daList(34) = "010110101101000214"
daList(35) = "001010110110000204"
daList(36) = "100100110111030124"
daList(37) = "100100101110000211"
daList(38) = "110010010110170131"
daList(39) = "110010010101000219"
daList(40) = "110101001010000208"
daList(41) = "110110100101060127"
daList(42) = "101101010101000215"
daList(43) = "010101101010000205"
daList(44) = "101010101101140125"
daList(45) = "001001011101000213"
daList(46) = "100100101101000202"
daList(47) = "110010010101120122"
daList(48) = "101010010101000210"
daList(49) = "101101001010170129"
daList(50) = "011011001010000217"
daList(51) = "101101010101000206"
daList(52) = "010101011010150127"
daList(53) = "010011011010000214"
daList(54) = "101001011011000203"
daList(55) = "010100101011130124"
daList(56) = "010100101011000212"
daList(57) = "101010010101080131"
daList(58)