Some data is exported from the MongoDB database for some reason today, and in order to send it to other people more visually, we use Mongovue's export as Excel function.However, after the export of a problem, there is a column of storage time, stored in a long type of milliseconds, after the export has automatically become the scientific notation. And not to distinguish the actual time from the scientific notation, even the original millisecond value
Add the following code to the controller:@InitBinder Public void Initbinder (Servletrequestdatabinder bin) { new SimpleDateFormat ("Yyyy-mm-dd HH:mm:ss"); Set your own date format new customdateeditor (DSF,true); Bin.registercustomeditor (Date. class , Cust);}After this annotation, the string type of data passed by the front end can be
SSSLINPPP1. SummaryWith regard to date types, Java and the database represent different methods:
Java: Only Java.util.Date and java.util.Calender two kinds;
Database: Date, time, datetime, timestamp, etc.;
When a persistence class defines ajava.util.Date A property of type, does hibernate define a property of that
Resolve the problem of selecting the storage time and date type in MySQL.
In general applications, we use the timestamp, datetime, int type to store the time format:
INt (corresponding to Integer or int in javaBean)
1. occupies 4 bytes
2. Fast query after an index is created
3. You can use between for conditional range search.
4. The time functions provided by my
SQL-TEXT, DATE, and SET data types in MySQL. A field in the MySQL data table must define a data type. There are about 25 options, most of which are straightforward, so there is not much to worry about. But there are a few things to mention. T the fields in the MySQL data table must have a defined data type. There are about 25 options, most of which are straightfo
Current_time Display current time now () displays the current datetime date and time type Year 1 byte 1901~2155 0 value 0000DATE 4 byte 1000-01-01~9999-12-31 0 value 0000:00:00time 3 bytes- 838:59:59~838:59:59 0 Value 00:00:00datetime 8 byte 1000-01-01 00:00:00~9999-12-31 23:59:59 0 value 0000-00-00 00:00:00timestamp 4 bytes 19700101080001~20380119111407 00000000000000 Note: Inserting the data beyond the ra
): You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near ' warning ' on line 1MYSQLG T SELECT * FROM test;+------+------------+| ID | hiredate |+------+------------+| 1 | 2015-12-08 | | 1 | 2015-12-08 |+------+------------+2 rows in Set (0.00 sec)Note: The first reason for not prompting warning is that the time part is 0.The same points for timestamp and datetime:1> Both can be used to represent a
Tags: ar sp strong data on the art code BSDatabase (string function, Date function, data type conversion Cast,convert)Use studentGoCREATE TABLE Yuangong(code int,Name varchar (20),Sex varchar (20),Age int,Bumen varchar (20),)INSERT into Yuangong values (1, ' Week number ', ' Male ', 27, ' sales Department ')INSERT into Yuangong values (1, ' King of the Week ', ' Male ', 27, ' sales Department ')INSERT into
Tags: codes sni code tab SSO text Format--FASIn MySQL for the time of the storage of their own table is set when the varchar type, it feels very convenient. Yesterday took someone else to build a table to write code, found that the time type of the table is DateTime, with the feeling of a try not to, on-line check the beginning of a number of tests are not right, a face Meng forced. ------------------------
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1 how to convert a string to an integer Int?
A. There are two methods:
1). Int I = integer. parseint ([String]); or
I = integer. parseint ([String], [int Radix]);
2). Int I = integer. valueof (my_str). intvalue ();
Note: The methods for converting strings to double, float, and long are similar.
2. How do I convert an integer int to a string?
A. There are three methods:1.) string S = string. valueof
Date-type data is always a headache, whether it's an MIS or an intranet (INTERNET) development, because it's not handled like a number or a string.
Do what you want, but horseshoes the program.
In the development process of web-webserver-database three-layer structure, date-type data is used more frequently, but for di
a user-defined data type.LengthOptional parameters for nchar, nvarchar, char, varchar, binary, or varbinary data types.StyleA date format style whereby DateTime or smalldatetime data is converted to character data (nchar, nvarchar, char, varchar, nchar, or nvarchar data type) or a string format style that will float, Real, money, or smallmoney data is converted to character data (nchar, nvarchar, char, var
In MySQL, the fields of SQL-TEXT, DATE, and SET data types in MySQL data tables must have a defined data type. There are about 25 options, most of which are straightforward, so there is not much to worry about. But there are a few things to mention.
TEXT
TEXT is not a data type, although it may be said in some books. It should actually be "long varchar" or "M
to do some algorithms such as computing weeks, DateDiff, DateAdd, and so on, it is troublesome, especially the large data query conversion type is the impact of efficiency Summary Should the field type of the date stored in the database be either varchar or datetime? Both methods have advantages, and datetime can borrow the arithmetic functions in the SQL functi
Tags: ret local date MY.CNF catalog cannot engine option weightWebsite moved, MySQL version upgraded from 5.6 to 5.7, encountered problems: After MySQL 5.7 version datetime defaults set ' 0000-00-00 ', an exception occurred:Invalid default value for ' Create_time ' Read the Manual The date type is used for values with a, a da
Tags: copy val composite star speed Mina Loader unit controlBefore the restoration of a unit in Shandong to restore the Oracle database, the data contained in the date type, at that time to provide customers with the Sqlldr way, because the volume of data is larger, with sqlldr loaded faster, so the use of this way, the result is also in the loading error, The solution is put out, make a summary.The data is
Tag: Push data sharing unsafe time format automatically deletes class init data typeIn the project, the date type is created in MONGO, and the MONGO set expiration is automatically deleted based on the date type. and the date type
SQL Server 2008 Date/Time data type
Directory
Prepare for Work 1
Exercise 1: Browse date and time data type 2
Exercise 2: Process date and time data type 6
Preparatory work
Estimated time required to complete this experiment
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.