SoFunction
Updated on 2025-04-07

Simple implementation method for jsp countdown

This article describes a simple implementation method for jsp countdown. Share it for your reference, as follows:

<%@ page language="java" import=".*" pageEncoding="UTF-8"%>
<%
 //The current time milliseconds Long current_time1=();
 //The end time milliseconds Long end_time2=1337875200000l;
 // Calculate the time difference Long time2=end_time2-current_time1;
   //Convert to seconds   int second=(int)(time2/1000); //Total seconds remaining   //Specify the number of seconds to the number of days   int s = second % 60; // Second   int mi = (second - s) / 60 % 60; // minute   int h = ((second - s) / 60 - mi ) / 60 % 24; // Hour   int d = (((second - s) / 60 - mi ) / 60 - h ) / 24; // sky   String ret= "Remaining:" + d + "sky" + h + "Hour" + mi + "minute" + s + "Second";
   //(ret);
%>

I hope this article will be helpful to everyone's JSP programming.