JSP countdown Simple Implementation Method _JSP programming

Source: Internet
Author: User
Tags current time

The example of this article describes the JSP countdown simple implementation method. Share to everyone for your reference, specific as follows:

<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%>
<%
 //Current time milliseconds
 long _time1=system.currenttimemillis ();
 End time milliseconds
 long end_time2=1337875200000l;
 Computation time difference 
 Long time2=end_time2-current_time1;
   Convert to seconds
   int second= (int) (time2/1000);//Total seconds remaining
   //number of seconds for
   int s = second% 60;//sec
   int mi = (second-s) /60% 60; Minutes
   int h = ((second-s)/60-mi)/60 24;//hour
   int d = ((second-s)/60-mi)/60-h)/24; Day
   String ret= "remaining:" + D + "days" + H + "hour" + mi + "min" + S + "seconds";
   SYSTEM.OUT.PRINTLN (ret);
%>

I hope this article will help you with JSP program design.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.