JavaScript converts calendars to calendars and javascript calendars.
I believe that when someone selects a date in the page, you need to know the calendar of the selected date! If it is Java, it can be converted at once in the background. But on the page, if JavaScript is used for conversion, do you have any good ideas? Some time ago, my friend asked this question and wrote a demo for her. Okay! I hope this will help you who need it. Okay, just go to the code and don't want to worry about it:
<% @ Page language = "java" import = "java. util. * "pageEncoding =" UTF-8 "%> <% String path = request. getContextPath (); String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/"; %> <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
Code has been pasted, the key here is a js: calendar-converter.js, mainly used to convert the Gregorian calendar! Attach this resource: http://download.csdn.net/download/luo201227/7616913
Finally, I added several images to everyone:
1:
2:
3:
Javascript code for converting a Gregorian calendar to a lunar calendar
You are making a "School Work? "
IF you do, I won't give you.
And if not, check out www.javaworld.com
How does javascript solar calendar convert to lunar calendar?
I have the algorithm code here. Please refer:
Var LunarDate = {madd: new Array (0, 31, 59, 90,120,151,181,212,243,273,304,334), HsString: 'Child ugly Yin Mao chen Wu Wei Xi Yu Hai ', NumString: "May 80 or 90 80 or 90", MonString: "May winter wax", CalendarData: new Array (0xA4B, 0x5164B, 0x6A5, 0x6D4, 0x0000b5, 0x2B6, 0x957, primary, 0x497, 0x60C96, 0xD4A, 0xEA5, primary, 0x5AD, 0x2B6, primary, 0x92E, 0x7192D, 0xC95, 0xD4A, 0x61B4A, 0xB55, 0x56A, 0x00005b, 0x25D, 0x92D, primary, 0xA95, 0x71695, 0x6CA, 0xB55, 0x50AB5, 0x4DA, 0xA5B, primary, 0x52B, primary, 0xE95, 0x6AA, 0x615AA, 0xAB5, 0x4B6, primary, 0xA57, 0x526, clerk, 0xD95, 0x70B55, 0x56A, 0x96D, 0x5095D, 0x4AD, 0xA4D, clerk, 0xD25, clerk, 0xB54, 0xB6A, 0x612DA, 0x95B, 0x49B, 0x41497, 0xA4B, 0xA164B, 0x6A5, 0x6D4, 0x615B4, 0xAB6, 0x957, 0x5092F, 0x497, 0x64B, 0x30D4A, 0xEA5, 0x80D65, 0x5A C, 0xAB6, 0x5126D, 0x92E, 0xC96, clerk, 0xD4A, 0xDA5, clerk, 0x56A, clerk, 0x25D, 0x92D, clerk, 0xA95, 0xB4A, 0x416AA, 0xAD5, clerk, 0x4BA, 0xA5B, 0x60A57, 0x52B, 0xA93, 0x40E95), Year: null, Month: null, Day: null, TheDate: null, GetBit: function (m, n) {return (m> n) & 1 ;}, e2c: function () {this. theDate = (arguments. length! = 3 )? New Date (): new Date (arguments [0], arguments [1], arguments [2]); var total, m, n, k; var isEnd = false; var tmp = this. theDate. getFullYear (); total = (tmp-1921) * 365 + Math. floor (tmp ...... remaining full text>