How to get datetime data in mysql, followed by .0

How to get datetime data in mysql, followed by .0

The data type of MySQL is datetime. The data stored in the database is 2015-01-19 05:02:02. When it is transferred to Java, it becomes 2015-01-19 05:02:02.0, with an extra .0 at the end.

The display format can be formatted by the following centralized method:

1. The type of regtime must be date type to be used in this way, which can be achieved through jstl

<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<fmt:formatDate value="${userDb.regtime}" pattern="yyyy-MM-dd HH:mm:ss"/>

2. The type of regtime is String, which is implemented by js

<div><script>document.write("${userDb.regtime}".substring(0, 19));</script></div>

3. The type of regtime is String, which is implemented by jstl

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<div>${fn:substring(userDb.regtime, 0, 19)}</div>

Display results: 2015-01-19 05:02:02

The above article about how to obtain datetime type data in MySQL, followed by a .0 implementation method, is all I have to share with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Summary of MySQL date data type and time type usage
  • Datetime and Timestamp comparison in Mysql
  • Solving the abnormality of mysql datetime query

<<:  JS implements Baidu search box

>>:  How to change the CentOS server time to Beijing time

Recommend

MySQL DML language operation example

Additional explanation, foreign keys: Do not use ...

JS implements click drop effect

js realizes the special effect of clicking and dr...

CSS makes tips boxes, bubble boxes, and triangles

Sometimes our pages will need some prompt boxes o...

SQL Aggregation, Grouping, and Sorting

Table of contents 1. Aggregate Query 1. COUNT fun...

Learn Node.js from scratch

Table of contents url module 1.parse method 2. fo...

How to deploy HTTPS for free on Tencent Cloud

Recently, when I was writing a WeChat applet, the...

Nginx monitoring issues under Linux

nginx installation Ensure that the virtual machin...

Mini Program to Implement the Complete Shopping Cart

The mini program implements a complete shopping c...

Introduction to who command examples in Linux

About who Displays users logged into the system. ...

This article will show you how to use Vue 3.0 responsive

Table of contents Use Cases Reactive API related ...

HTML web page image tag

Insert image tag <IMG> The colorful web page...

Detailed explanation of MySQL's Seconds_Behind_Master

Table of contents Seconds_Behind_Master Original ...

Solution to the problem that Navicat cannot remotely connect to MySql server

The solution to the problem that Navicat cannot r...