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 full-text search usage examples

Table of contents 1. Environmental Preparation 2....

Detailed explanation of flex and position compatibility mining notes

Today I had some free time to write a website for...

Summary of the main attributes of the body tag

bgcolor="text color" background="ba...

How to use time as a judgment condition in MySQL

Background: During the development process, we of...

Vue implements a simple magnifying glass effect

This article example shares the specific code of ...

Example of integrating Kafka with Nginx

background nginx-kafka-module is a plug-in for ng...

JavaScript Basics: Scope

Table of contents Scope Global Scope Function Sco...

How to make your JavaScript functions more elegant

Table of contents Object parameters using destruc...

How to deploy Tencent Cloud Server from scratch

Since this is my first post, if there are any mis...

Docker setting windows storage path operation

When installing Docker on Windows 10, after selec...

Web page creation for beginners: Learn to use HTML's hyperlink A tag

The hyperlink a tag represents a link point and i...

The whole process of Vue page first load optimization

Table of contents Preface 1. Image Optimization 2...