Home Database Mysql Tutorial mysql+mssql+oracle的时间日期类型

mysql+mssql+oracle的时间日期类型

Jun 07, 2016 pm 03:08 PM
date time type

1: sql server 日期类型: 为 'YYYY-MM-DD HH:MM:SS 2. mysql 日期和时间类型: DATE ,日期。支持的范围为 '1000-01-01' 到 '9999-12-31' 。 MySQL 以 'YYYY-MM-DD' 式显示 DATE DATETIME ,日期和时间的组合。支持的范围是 '1000-01-01 00:00:00' 到 '9999

1: sql server 日期类型:

'YYYY-MM-DD HH:MM:SS

2. mysql日期和时间类型:
DATE,日期。支持的范围为'1000-01-01''9999-12-31'MySQL'YYYY-MM-DD'格式显示DATE
DATETIME
,日期和时间的组合。支持的范围是'1000-01-01 00:00:00''9999-12-31 23:59:59'MySQL'YYYY-MM-DD HH:MM:SS'格式显示DATETIME
TIMESTAMP[(M)]
,时间戳。TIMESTAMP值返回后显示为'YYYY-MM-DD HH:MM:SS'格式的字符串,显示宽度固定为19个字符。
TIME
,时间。范围是'-838:59:59''838:59:59'MySQL'HH:MM:SS'格式显示TIME
YEAR[(2|4)]
,两位或四位格式的年。默认是四位格式。在四位格式中,允许的值是190121550000。在两位格式中,允许的值是7069,表示从1970年到2069年。MySQLYYYY 格式显示YEAR

3:JAVA默认的日期时间格式为       

 Thu Jul 07 17:05:39 CST 2005

如果想转化为2005-07-05 的格式,则需要使用类 SimpleDateFormat

  SimpleDateFormat formatt= new SimpleDateFormat("yyyy-MM-dd") ;
 Date date =new Date();
 System.out.println(formatt.format(date));

 则打印出的格式为:2005-07-07

  SimpleDateFormat formatt= new SimpleDateFormat("yyyy-MMMM-dd") ;
 Date date =new Date();
 System.out.println(formatt.format(date));

  则打印出的格式为:2005-七月-07

---------------------------

4:Oracle的默认日期格式

SQL> select sysdate from dual ;

SYSDATE
----------
07-7月-05

用to_char转化为yyyy-mm-dd的格式

SQL> select to_char(sysdate,'yyyy-mm-dd') Time from dual ;
TIME

----------
2005-07-07

在Oracle里有两个与date相关的函数 to_date()和to_char() ;

to_date() 作用将字符类型按一定格式转化为日期类型:
具体用法:to_date('2004-11-27','yyyy-mm-dd'),前者为字符串,后者为转换日期格式,注意,前后两者要以一对应。
如;to_date('2004-11-27 13:34:43', 'yyyy-mm-dd hh24:mi:ss') 将得到具体的时间
to_date() 作用将字符类型按一定格式转化为日期类型:
具体用法:to_date('2004-11-27','yyyy-mm-dd'),前者为字符串,后者为转换日期格式,注意,前后两者要以一对应。
如;to_date('2004-11-27 13:34:43', 'yyyy-mm-dd hh24:mi:ss') 将得到具体的时间.


来源:小伙伴开发网http://www.kaifaer.com/

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to search previous Weibo by date on Weibo_How to search previous Weibo by date on Weibo How to search previous Weibo by date on Weibo_How to search previous Weibo by date on Weibo Mar 30, 2024 pm 07:26 PM

1. First open the mobile web browser, search for the Weibo web version, and click the avatar button in the upper left corner after entering. 2. Then click Settings in the upper right corner. 3. Click the version switching option in settings. 4. Then select the color version option in the version switch. 5. Click Search to enter the search page. 6. After entering the keywords, click Find People. 7. When the search completion interface appears, click Filter. 8. Finally, enter the specific date in the release time column and click Filter.

How much does a Douyin level 10 light sign cost? How many days does it take to create a level 10 fan sign? How much does a Douyin level 10 light sign cost? How many days does it take to create a level 10 fan sign? Mar 11, 2024 pm 05:37 PM

On the Douyin platform, many users are eager to obtain level certification, and the level 10 light sign shows the user's influence and recognition on Douyin. This article will delve into the price of Douyin’s level 10 light boards and the time it takes to reach this level to help users better understand the process. 1. How much does a level 10 Douyin light sign cost? The price of Douyin's 10-level light signs will vary depending on market fluctuations and supply and demand. The general price ranges from a few thousand yuan to ten thousand yuan. This price mainly includes the cost of the light sign itself and possible service fees. Users can purchase level 10 light signs through Douyin’s official channels or third-party service agencies, but they should pay attention to legal channels when purchasing to avoid false or fraudulent transactions. 2. How many days does it take to create a level 10 fan sign? Reach level 10 light sign

How to remove the date that appears automatically when printing from PPT handouts How to remove the date that appears automatically when printing from PPT handouts Mar 26, 2024 pm 08:16 PM

1. Let me first talk about the method I used at the beginning, maybe everyone is using it too. First, open [View]——]Remarks Template[. 2. A place where you can actually see the date after opening it. 3. Select it first and delete it. 4. After deleting, click [Close Master View]. 5. Open the print preview again and find that the date is still there. 6. In fact, this date was not deleted here. It should be in the [Handout Master]. Look at the picture below. 7. Delete the date after you find it. 8. Now when you open the preview and take a look, the date is no longer there. Note: In fact, this method is also very easy to remember, because the printed handouts are handouts, so you should look for the [Handout Master].

How to set the time for publishing works on Xiaohongshu? Is the time for publishing the work accurate? How to set the time for publishing works on Xiaohongshu? Is the time for publishing the work accurate? Mar 24, 2024 pm 01:31 PM

Xiaohongshu, a platform full of life and knowledge sharing, allows more and more creators to express their opinions freely. In order to get more attention and likes on Xiaohongshu, in addition to the quality of content, the time of publishing works is also crucial. So, how to set the time for Xiaohongshu to publish works? 1. How to set the time for publishing works on Xiaohongshu? 1. Understand the active time of users. First, it is necessary to clarify the active time of Xiaohongshu users. Generally speaking, 8 pm to 10 pm and weekend afternoons are the times when user activity is high. However, this time period will also vary depending on factors such as audience group and geography. Therefore, in order to better grasp the active period of users, it is recommended to conduct a more detailed analysis of the behavioral habits of different groups. By understanding users’ lives

How long does it take to clear the Elden Ring? How long does it take to clear the Elden Ring? Mar 11, 2024 pm 12:50 PM

Players can experience the main plot of the game and collect game achievements when playing in Elden's Circle. Many players don't know how long it takes to clear Elden's Circle. The player's clearance process is 30 hours. How long does it take to clear the Elden Ring? Answer: 30 hours. 1. Although this 30-hour clearance time does not refer to a master-like speed pass, it also omits a lot of processes. 2. If you want to get a better game experience or experience the complete plot, then you will definitely need to spend more time on the duration. 3. If players collect them all, it will take about 100-120 hours. 4. If you only take the main line to brush BOSS, it will take about 50-60 hours. 5. If you want to experience it all: 150 hours of base time.

Detailed explanation of Linux file time viewing techniques Detailed explanation of Linux file time viewing techniques Feb 21, 2024 pm 01:15 PM

Detailed explanation of Linux file time viewing techniques In Linux systems, file time information is very important for file management and tracking changes. The Linux system records file change information through three main time attributes, namely access time (atime), modification time (mtime) and change time (ctime). This article details how to view and manage this file time information, and provides specific code examples. 1. Check the file time information by using the ls command with the parameter -l to list the files.

How to change the date into a pound sign in Excel How to change the date into a pound sign in Excel Mar 20, 2024 am 11:46 AM

Excel software has very powerful data processing functions. We often use excel software to process various data. Sometimes when we enter a date in an excel cell, the date in excel changes to a pound sign. How can we display the data normally? Let’s take a look at the solution below. 1. First, we put the mouse on the column width line between columns AB, double-click and adjust the column width, as shown in the figure below. 2. After the column is widened, we find that numbers are displayed in the cells instead of dates. This is definitely incorrect. Then we should check the format of the cells, as shown in the figure below. 3. Click the "Number" option in the "Home" tab, and click "Other Number Format" in the drop-down menu, as shown in the figure below.

How to adjust the time on gshock watch How to adjust the time on gshock watch Feb 21, 2024 pm 09:04 PM

Many users are not sure how to adjust the time of the gshock watch. The overall method is relatively simple. Here is a detailed introduction to the adjustment method of the gshock watch. Users who do not know how to operate can refer to it. How to adjust the time on a gshock watch 1. First label these buttons according to ABCD. A key: It can be understood as the exit key, usually used together with the C key. The B key and the D key can be understood as: plus and minus keys, which are the adjustment keys. For example, if it is 13 o'clock now, press the D key when it reaches 14 o'clock. The C key is the mode key. You can switch modes by pressing it. Generally, the mode key of a watch is in the lower left corner and has the word "mode" in English. Operation method 1. First we need to adjust the watch to the

See all articles