Calendar through the project to understand the time and date application

2010-03-29  来源:本站原创  分类:Java  人气:252 

Through the project understand the Calendar application, which is itself written in a small function, applied to the Calendar
On the date, time, some of the usage of
Calendar through the project to understand the time and date application

Page code:

<script type="text/javascript">
"! --

//-->
function up (form) (
alert ( "up");
var s = document.forms [0]. action = "/ cms / frontpage / calendar / List.action? id = 2";
document.forms [0]. submit ();
)
function ok (form) (
alert ( "ok");
form.action = "/ cms / frontpage / calendar / List.action? id = 1";
form.submit ();

)
function next (form) (
alert ( "next");
form.action = "/ cms / frontpage / calendar / List.action? id = 3";
form.submit ();

)
</ script>
<body>
<table align="center">
<tr> <td align="center"> <font size="+3" color="red"> important activities of the regional leaders have one week notice </ font> </ td> </ tr>
<tr> <td align="center">
Current time range: $ (root.minDate }------${ root.maxDate);
</ td>
</ tr>
</ table>

<table align="center" border="1" width="780">
<tr bgcolor="blue">
<td> Date </ td>
<td> Time </ td>
<td> Activities </ td>
<td> participation in leadership </ td>
<td> Location </ td>
<td> contractors Department </ td>
<td> Notes </ td>

</ tr>
<# list root.PageBean.pageData as row>
<tr>
<td> $ (row.cday) </ td>
<td> $ (row.ctime) </ td>
<td> $ (row.content) </ td>
<td> $ (row.leader) </ td>
<td> $ (row.adds) </ td>
<td> $ (row.dept) </ td>
<td> $ (row.beizu) </ td>

</ tr>
</ # list>
</ table>

<form action="" method="post">
<table align="center">

<tr>
<td> <input type="button" value=" The previous week "> </ td> <td>
<input type="button" value=" This week ">
</ td> <td> <input type="button" value=" The next week "> </ td>
</ tr>
</ table>
</ form>

Background Code:

Calendar d = Calendar.getInstance ();
int week = d.get (d.DAY_OF_WEEK) -1; / / Today is the week for several weeks, returning 0 is Sunday
int year = d.get (d.YEAR); / / year
int month = d.get (d.MONTH) +1; / / month
System.out.println (month);
int day = d.get (d.DAY_OF_MONTH); / / day
int max = 7-week; / / demand the same day a few days off this week
int maxDay = day + max;
int minDay = day-week +1;
String nowDate = "";
String maxDate = "";
String minDate = "";
String id = (String) this.get ( "a");
String cid = (String) this.get ( "id");
if (cid == null) (
cid = "1";
)
/ / 1 is the week two last week, three next week
if ( "1". equals (cid)) (

nowDate = (year +"-"+ month +"-"+ day +""); / / current time
maxDate = (year +"-"+ month +"-"+ maxDay +"");// a week maximum
minDate = (year +"-"+ month +"-"+ minDay +"");// minimum of one week
pb.Query ( "select * from webcalendar where ctime between '" + minDate + "' and '" + maxDate + "'");
)

else if ( "2". equals (cid)) (

nowDate = (year +"-"+ month +"-"+ day +""); / / current time
maxDate = (year +"-"+ month +"-"+( maxDay-7 )+"");// a week maximum
minDate = (year +"-"+ month +"-"+( minDay-7 )+"");// minimum of one week
pb.Query ( "select * from webcalendar where ctime between '" + minDate + "' and '" + maxDate + "'");
)
else if ( "3". equals (cid)) (

nowDate = (year +"-"+ month +"-"+ day +""); / / current time
maxDate = (year +"-"+ month +"-"+( maxDay +7 )+"");// a week maximum
minDate = (year +"-"+ month +"-"+( minDay +7 )+"");// minimum of one week
pb.Query ( "select * from webcalendar where ctime between '" + minDate + "' and '" + maxDate + "'");
)

This article comes from: Liu Meng blog text links:
http://www.liuzm.com/article/java/9716a.htm
More JAVA knowledge, please go to http://www.liuzm.com

相关文章
  • Calendar through the project to understand the time and date application 2010-03-29

    Through the project understand the Calendar application, which is itself written in a small function, applied to the Calendar On the date, time, some of the usage of Page code: <script type="text/javascript"> "! -- //--> function u

  • Upload a ssh the whole project to facilitate the spring of web-based application built 2010-12-07

    web with struts2, spring hibernate component Because the upload file size is limited, so pack it with several other jar download additional compression to be uploaded into the web-inf lib directory under

  • [Change] Project Management Study Notes 2009-08-07

    Chapter learning objectives outlined in Project Management 1. Explain what the project, and cited specific examples of information technology projects 2. To understand project management and other subjects the relationship between the 3. To understan

  • Project, project management and project opinion 2010-03-08

    A while ago, a colleague asked me to talk about key management and project-related stuff, so order a bit: Project Definition: refers to a system of unique, complex and interrelated activities, which has a clear objective or purpose, must be given tim

  • How to apply for a project manager or a project manager! (IT) 2011-04-23

    Introduction The purpose of this paper is to apply for project managers to help. Project management is the promotion of the way, need to use your past development experience, and salaries are usually higher than the programmer. Preparation of project

  • How to Apply to become project managers or project managers! (IT) 2011-04-23

    Introduction The purpose of this paper is to assist the project manager candidates. Project management is the promotion of the way, need to use your past development experience, and salaries are usually higher than the programmer. Preparation of proj

  • Project (Project Planning) SG Introduction 2009-05-10

    We all understand that such a reason: to do things in a planned, there is an immature plan is better than no plan, software development activity so complex, we need more plans. How should we then do a good job in a project? If the project scope, scal

  • History Project Description 2010-03-06

    Beijing Ninetowns import and export e-commerce software company's new Baiyun Airport Customs control service platform the new Baiyun Airport, "Airport Logistics regulatory information platform" development and construction of new airports is Cus

  • IPMP and project management 2010-04-02

    More simply, IPMP relationship with the PMP: IPMA-International Project Management Organization, established in 1965 in Lausanne, Switzerland, at a time after World War II; USA 1984, the PMI-Project Management Institute, presented a PMBOK-Project Man

  • IT project management in the six error of thinking 2010-04-16

    Error 1: Error demand research phase, resulting in many projects never end! In the software industry, there is no formal show in interface design to the customer before work is in demand all the research stage. In fact, doing the construction industr

  • [Translation] enterprise architect must look beyond the limitations of the project to get a better BPM 2010-04-25

    Original: Enterprise architects must look beyond project boundaries for better BPM Analysis: Mike Pontacoloni Source: http://searchsoa.techtarget.com/tip/0, two hundred and eighty-nine thousand four hundred and eighty-three, sid26_gci1381250, 00.html

  • IT project management in the six fatal error 2010-06-01

    Error 1: Error demand research phase, resulting in many projects never end! In the software industry, there is no formal show in interface design to the customer before work is in demand all the research stage. In fact, the construction industry a pr

  • Project Manager Alliance / little-known software project management principles 2010-08-03

    Cruel reality of software development tells us: No rules the software development process could only be brought about unexpected results. Most of us project managers have in their personal resume writes: "With years of rich experience in project mana

  • A perfect project manager 2010-08-20

    To smooth the implementation of the project is not simple, and if She and a number of units working together, they greatly increased the degree of difficulty. Obtain PMP certification or IPMP, but that individuals have the basic skill of project mana

  • Project Management Classic Monitor 2010-09-15

    1, China is full of a lot of very dedicated professional project managers but not enough, do not understand this, it is good to do projects in China. 2, the real reasons are often hidden behind the surface of the ground. 3, the highest state of a pro

  • [Change] IT project management of the three conditions. Five steps 2010-09-19

    Project is to complete a unique product or service made a one-time effort. According to this definition, the project has the goal of clarity on, one-time activities and resource consumption and other characteristics. In other words, with three main c

  • I do the project all these years (autumn is how well the project manager - the black humor 313) | How to Project Manager after -70 ... (Reprinted) 2010-09-25

    Akiba , Xiao Qiushui co new book, " ahead of the competition - big projects before and after sales of 30 kinds of skills , "wrote the book side of Akiba attention big project consultants, business and implement some of the sentiment, the section

  • IT Project Management 2010-12-07

    From the Internet Any project will be in the scope, timing and cost of three bound. Project management, is to scientific methods and tools, in scope, time, cost between the three find a proper balance to all project stakeholders are satisfied as much

  • Daily log of the project manager articles 2010-12-07

    Most R & D project managers have encountered such confusion: "As a project manager to arrange people into my project there are always many people at the same time in other projects, I found that they sometimes work in my project, I do not know wh

  • Quick-Kill Project Management 2006-07-29

    * This is my famous Dr.Dobb today in the United States to see a development site on a high degree of concern about the article. I happen to have used text speak (or similar) method, and good results, so it is translated as a reference. Original: Quic