?
Just some JavaScript to give you an idea: var now = new Date();
var timeStr = "";
timeStr = now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate() + " ";
timeStr += now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds();
Just some JavaScript to give you an idea: var now = new Date();
var timeStr = "";
timeStr = now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate() + " ";
timeStr += now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds();
解决方案 »
- 普通button模拟表单提交功能
- 悬浮框
- JS中的速度效率问题
- 如何用js判断动态数组值是否为空
- 如何在点击第二个节点的时候其他节点消失,看看代码吧(不错的效果)
- 问,我下面的一段ASP程序,返回值的时候如何将返回值加入表格(提示就有分)
- 求职 jquery.js 和 jquery-1.10.2.min.js 冲突了怎么办?
- ‖『50分请教一个JAVASCRIPT的特效』‖
- 怎么用Ext form调用一个jsp页面
- vue二级遍历菜单中进行路由如何动态实现rounter-link的to属性中我希望得到对应遍历的路由路径
- 在删除的时候,再次决定是否要删除,免得删除错了,怎么编写啊?
- js中可以给action传递过来的变量赋值吗?
<%@ page session="true" %>
<%@ page import="java.text.SimpleDateFormat,java.sql.Date"%>
<html>
<head>
<title>emu</title>
</head>
<body>
<%
SimpleDateFormat formatter;
Date d = new Date(0);
out.println(d+"<br>");
formatter=new SimpleDateFormat("yyyy-mm-dd");
out.println(formatter.format(d)+"<br>");
formatter=new SimpleDateFormat("yyyy/mm/dd");
out.println(formatter.format(d)+"<br>");
formatter=new SimpleDateFormat("yy-mm-dd");
out.println(formatter.format(d)+"<br>");
formatter=new SimpleDateFormat("yy/mm/dd");
out.println(formatter.format(d)+"<br>");
%>
</body>
</html>
-----------------------------------------btw,the Date class in java.sql package is inherit from the one in java.util,and the formatter can work with both.Class Datejava.lang.Object
|
+--java.util.Date
|
+--java.sql.Date
-----------------------------------------------
<%@ page session="true" %>
<%@ page import="java.text.SimpleDateFormat,java.sql.Date"%>
<html>
<head>
<title>emu</title>
</head>
<body>
<%
SimpleDateFormat formatter;
Date d = new Date(0);
out.println(d+"<br>");
formatter=new SimpleDateFormat("yyyy-MM-DD");
out.println(formatter.format(d)+"<br>");
formatter=new SimpleDateFormat("yyyy/MM/DD");
out.println(formatter.format(d)+"<br>");
formatter=new SimpleDateFormat("yy-MM-DD");
out.println(formatter.format(d)+"<br>");
formatter=new SimpleDateFormat("yy/MM/DD");
out.println(formatter.format(d)+"<br>");
%>
</body>
</html>
-----------------------------------------------m means minute and M means Month
-----------------------------------------------
<%@ page session="true" %>
<%@ page import="java.text.SimpleDateFormat,java.sql.Date"%>
<html>
<head>
<title>emu</title>
</head>
<body>
<%
SimpleDateFormat formatter;
Date d = new Date(Long.parseLong("1000000000000"));
out.println(d+"<br>");
formatter=new SimpleDateFormat("yyyy-MM-dd");
out.println(formatter.format(d)+"<br>");
formatter=new SimpleDateFormat("yyyy/MM/dd");
out.println(formatter.format(d)+"<br>");
formatter=new SimpleDateFormat("yy-MM-dd");
out.println(formatter.format(d)+"<br>");
formatter=new SimpleDateFormat("yy/MM/dd");
out.println(formatter.format(d)+"<br>");
%>
</body>
</html>
-----------------------------------------------see this: Symbol Meaning
------ -------
G era designator
y year
M month in year
d day in month
h hour in am/pm (1~12)
H hour in day (0~23)
m minute in hour
s second in minute
S millisecond
E day in week
D day in year
F day of week in month
w week in year
W week in month
a am/pm er
k hour in day (1~24)
K hour in am/pm (0~11)
z time zone
' escape for text
'' single quote
Date(Long.parseLong("1000000000000"));
why need to use the 1000000000000 to get the 2001-09-09 date, how to caculate?and other question if i need to email reminder, that's mean i have a timesheet table and have an attribute in this table (submission_date). If the date in this attribute is late for each monday then we need to automatically to generate an email to reminder the staff to submit their timesheet. This procedure is in oracle or in jsp? i can't find any method to realise.
Constructs a Date object using a milliseconds time value. If the given milliseconds value contains time information, the driver will set the time components to the time in the default time zone (the time zone of the Java virtual machine running the application) that corresponds to zero GMT.-------------------------------------------------------public Date(int year,
int month,
int day)
Deprecated. instead use the constructor Date(long date)Constructs a Date object initialized with the given year, month, and day.The result is undefined if a given argument is out of bounds.Parameters:year - the year minus 1900; must be 0 - 9999
month - 0 to 11
day - 1 to 31-----------------------------------------------------------
public Date(int year,
int month,
int date,
int hrs,
int min)
Deprecated. As of JDK version 1.1, replaced by Calendar.set(year + 1900, month, date, hrs, min) or GregorianCalendar(year + 1900, month, date, hrs, min).Allocates a Date object and initializes it so that it represents the instant at the start of the minute specified by the year, month, date, hrs, and min arguments, in the local time zone.Parameters:year - the year minus 1900.
month - the month between 0-11.
date - the day of the month between 1-31.
hrs - the hours between 0-23.
min - the minutes between 0-59.See Also:Calendar
select to_date(start_time,'yyyy-mm-dd') from tablename
select to_date(start_time,'yyyy/mm/dd') from tablename
select to_date(start_time,'yy/mm/dd') from tablename
....