Chinese)
That is, each time a numeric value of date type is displayed, Oracle automatically calls the To_char function and displays the format as a parameter in the default date. We can explicitly call the To_char function and specify the format that we want. For example:
SELECT To_char (b, ' Yyyy/mm/dd ') as b from X;
The result returned is:
B
------------
20
Tags: name FIFO return full current max varchar SYS int 1. Conversion functionThe most significant relationship with the date operation is two conversion functions: To_date (), To_char ()The To_date () function converts a character type to a date type in a certain format:Specific usage: to_date (' 2004-11-27 ', ' yyyy-
the input data of the function is different from the data type required by the input parameter of the function, an implicit conversion will occur, if the two types cannot be converted between the words will be an error. Because of the fact that its errors have been quite concealed, it is quite troublesome to find them.
solution to the problem
First: Use conversion functions, that is, explicit conversions
]
Is the millisecond, if not the number is the default precision.
Can only be used with timestamp types.
16
Fm
One of the notable functions: no content is returned.
I'm not sure why Oracle set this thing up.
17
Fx
Ditto
18
HH
Represents hours, 12-hour, with Hh12 (1-12)
19
HH12
Represents ho
Oracle obtains the current date and date format. system date: SYSDATE () converted Date: TO_CHAR (SYSDATE (), YYMMDDHH24: MI: SS), TO_DATE (SYSDATE (), YYMMDDHH24: MI: SS) converted number: TO_NUMBER Note: TO_CHAR converts a date
converted to dateCalendar ca=calendar.getinstance ();Date d = (date) ca.gettime ();
4 Java.sql.TimestampIncludes year, month, day, time, minutes, seconds,
nanosecond (Nano)Information.
Inherited from Java.util.Date. Contains more information than Java.sql.Date. Used in database related operations, such as Rs.gettimestamp,ps.settimestamp. For example, if a field in a database is hiredate to the
Mysql date and character conversion date_format (date, '% Y-% m-% D') --------------> to_char () in oracle; str_to_date (date, '% Y-% m-% D') --------------> to_date () in oracle; www.2cto.com % Y: indicates the 4-digit year % y:
Data cleansing Note: correct English date conversion reports "invalid month", note English
Original Works are from the blog of "Deep Blue blog". You are welcome to repost them. You must specify the source when you repost them. Otherwise, you have the right to pursue legal liability for copyright.
Deep Blue blog: http://blog.csdn.net/huangyanlong/article/details/46340291
Background]
Data in the format of "9
+ "', '" + mytechnical + "', to_date (' +mybirthday+ ', ' yyyy-mm-dd '), '" + Myemail + "', '" + mytelephone
To_date (', ') does not need to be added to the SQL statement, but in order to get the variable it must be in the above format
First, use the Oracle function:
To_timestamp_tz (' 2009-3-9 17:51:23.23-05:00 ', ' yyyy-mm-d HH24:MI:SS. FF Tzh:tzm ')
To_date (yourdate, ' yyyy-mm-d HH24:MI:SS '); String Go Date
Generally written in java+oracle background, may give you back the time style is this:2014-01-20 13:24:33Look at this time string is more complex, but the iOS SDK has been packaged for us to convert NSString to any nsdate or nsstringUsing the NSDateFormatter implementation+ (NSString *) timefromstring: (NSString *) timestring{ NSDateFormatter *formatter = [[NSDateFormatter alloc] init];in this way, you can convert any received background time strin
Oracle obtains the current date and Date Format
Get system date: sysdate ()Format Date: to_char (sysdate (), 'yy/MM/DD hh24: MI: SS)Or to_date (sysdate (), 'yy/MM/DD hh24: MI: SS)Format the number: to_number
Note: to_char converts a
1. When working with the Oracle database using JDBC, the date type of the database that corresponds to the java.sql.Date type is used, which can be saved and read only at this time.Time (hours, minutes, seconds) can not be read and saved;The query result set can get data of the Date type directly: Java.sql.Date date=re
Mysql date and character conversion between bitsCN.com
Mysql date and character conversion date_format (date, '% Y-% m-% d') --------------> to_char () in oracle; str_to_date (date, '%
Date functionDate functions manipulate Date values (fields of date type), timestamp values (TIMESTAMP, TIMESTAMP with time ZONE, and TIMESTAMP with the fields of the local time ZONE type), and interval values (INTERVAL day to SECOND and INTERVAL year to MONTH).
Most date functions, such as add_months, Current_date, La
server| Convert SQL Server Chinese version of the default Date field datetime format is YYYY-MM-DD Thh:mm:ss.mmm
For example:
Select GETDATE ()
2004-09-12 11:06:08.177
This is somewhat inconvenient for people who are YYYY-MM-DD HH24:MI:SS to transfer data between databases or are accustomed to the Oracle date format.
I've sorted out the
O_date ("string to be converted", "format to be converted") must match the format of the two parameters. Otherwise, an error is returned.That is, the first parameter is interpreted according to the format of the second parameter.To_char (date, "conversion format") converts a given date according to the "conversion form
The default datetime format of the Chinese version of SQL Server is yyyy-mm-dd thh: mm: Ss. Mmm. For example: Select getdate () 11:06:08. 177 This is inconvenient for people who want to migrate data between different databases or get used to the Oracle Date Format YYYY-MM-DD hh24: MI: Ss. I sorted out the date format co
The default datetime format of the Chinese version of SQL Server is yyyy-mm-dd thh: mm: Ss. Mmm.
For example:
Select getdate ()
11:06:08. 177
This is inconvenient for people who want to migrate data between different databases or get used to the Oracle Date Format YYYY-MM-DD hh24: MI: Ss.
I sorted out the date format
Oracle date weekly explanation and weekly start and end time calculation, oracle End Time
1 ORACLE weekly knowledge description
1.1 date formatting Functions
TO_CHAR (X [, FORMAT]): Convert X to a string in FORMAT. X is a date, a
1 digit of ISO year.
-
AdA.D.
Ad indicator with or without periods.
-
BCB .C.
BC indicator with or without periods.
-
CCSCC
One greater than the first two digits of a four-digit year; "S" prefixes BC dates "-".For example, '20' from '123 '.
-
D
Day of week (1-7 ).
-
A.m.P. M.
Meridian indicator with periods.
-
Tzh
Time zone hour.
-
Tzm
Time zone minute.
-
Tzr
Time Zone regi
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.