Mysql acquires datetime-type data, followed by A. 0 implementation method, datetime.0

Source: Internet
Author: User

Mysql acquires datetime-type data, followed by A. 0 implementation method, datetime.0

The data type of mysql is datetime, and the data stored in the database is 05:02:02. Uploaded to java becomes 05:02:02. 0, with an additional tail. 0,

You can use the following centralized method to display the format:

1. The regtime type can be used in this way only by date type. It is implemented 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 regtime type is String, which is implemented through js.

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

3. The regtime type is String, which is implemented through jstl.

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

Result: 05:02:02

The above mysql obtains datetime data, which will be followed by. the implementation method of 0 is to share all the content with you, hoping to give you a reference, and hope you can provide more support for helping customers.

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.