In oracle, the month or part of data is obtained from the specified date. The oracle date
Obtain part of the data from the specified date:
Such as month:
Select to_CHAR (sysdate, 'mm') from dual;
Or:
Select extract (month from sysdate) from dual;
Or the most stupid met
Extract the date part of the DateTime column in the database field:
(1) select Datename (year, GetDate () + '-' + Datename (month, GetDate () + '-' + Datename (day, GetDate ())
(2) select convert (varchar (10), getdate (), 120)
(3) select * from MyDsk _ reminder where year (reservation time) = '000000' and month (reservation time) = '8' and Day (reservation time) = '29' and reminder ID = '123'
(4) select
indicator (Z) makes it easier to map an XML datetime value with time zone information to a SQL Server datetime value that does not have a time zone. Z is an indicator of the time zone UTC-0. Other time zones are indicated by a hh:mm offset of + or-direction. For example: 2006-12-12T23:45:12-08:00 .When converting from smalldatetime to character data, styles containing seconds or milliseconds will display zeros at these locations. When converting from a datetime or smalldatetime value using the
This article is suitable for primary readers
Chuck Allison is a software architect at the Family History Research division of the Church of Christ, Salt Lake City St. Latter Day Church headquarters. He has a Bachelor of Mathematics and a master's degree in mathematics. He has been programming since 1975, and since 1984 he has been engaged in the teaching and development of C language. His current interest is in object-oriented technology and its education. He is a member of the X3j16,ansi C + +
Tags: composition highlight char Data time interception Introduction Group SeleIn this article, the date GetDate () is made up of two parts, namely today's date and time of day: Select GetDate ()With Datename () you can get the corresponding year, month, day, and then connect them together: Select Datename (Year,getdate ()) + '-' +datename(Month,getdate ()) + '-' +datename (Day,getdate ()) In addition, Date
In this article, the date GetDate () is made up of two parts, namely today's date and time of day: Select GetDate ()With Datename () you can get the corresponding year, month, day, and then connect them together:Select Datename (Year,getdate ()) + '-' +datename(Month,getdate ()) + '-' +datename (Day,getdate ())In addition, Datename () can also get hours, times, seconds, days of the week, weeks, respectively
fieldUpdate DSet Birth=stuff (convert (nvarchar, birth,120), 6, 2, ' 3 ')--Change the number of days in the D Table Date fieldUpdate DSet Birth=stuff (convert (nvarchar, birth,120), 9, 2, ' 25 ')--Change the number of hours in the D Table Date fieldUpdate DSet Birth =stuff (convert (nvarchar, birth,120), 12, 2, ' 9 ')--Change the number of minutes in the D Table Date
Obtain part of the data from the specified date, such as month: selectto_CHAR (sysdate, MM) FROMDUAL; or: selectextract (monthfromsysdate) fromdual; or the most stupid method, use to_char () first, convert the date to a string in the specified format and obtain the desired data through substr. Selectsubstr (
Obtain part
Tags: part sysdate SDA min Div format day cond from(1) Oracle Extract () function introduced from Oracle 9i to intercept a specific part from a date or interval type, syntax: Extract ({year | month | day | hour | minute | seco nd} | {timezone_hour | timezone_minute} | {timezone_region | timezone_abbr} from {date_value | interval_value}).---example:Select Extract
Label: Date_format (Date,format)
Formats the date value according to the format string. The following modifiers can be used in the format string:%M month name (January ... December)%W week name (Sunday ... Saturday)%d The date of the month with English prefixes (1st, 2nd, 3rd, etc.). )%Y year, number, 4-digit%Y year, number, 2-bit%a abbreviated weekday name (
Obtain the datetime date in an SQL statement.
Datetime data is often operated in SQL statements. When writing a stored procedure today, We need to extract the date part of a datetime value. There are many introductions on the Internet.
The main method is to convert the date format. As follows:
Select convert (varchar (
Often encountered in the work, in order to query the SQL report, query results are required by date to list, or by day, or by month, year.This time we are often distressed, datetime is accurate to milliseconds, if the simple group by datetime will result in incorrect results.This is what we can do with the CONVERT function:SELECT CONVERT (varchar), createdate,120, var1, Var2from tablegroup by convert (varchar), createdate,120) ASCThe first parameter i
In my personal opinion, it is simpler than nsdatecomponents. After a simple test, there is no problem. If you have any questions about the test, please provide your feedback.
Nsdate * olddate = [nsdate date];Nstimeinterval interval = olddate. timeintervalsince1970;
// Divide interval minus interval by the remainder of the number of seconds in a day.
// Nstimeinterval is actually of the double type, and % can only be used in the int type, so the f
Tags: select field Oct Day ORM Format IDE mat whereIntercept using the Date_format (get_date, '%y-%m-%d ') function. Where: Get_date is the field name to intercept, and '%y-%m-%d ' is the date format after interception. Select Date_format (' 1997-10-04 22:23:00 ', '%y%M%b%d%W%a%y-%m-%d%h:%i:%s%r%T '); Results: October Oct 4th Saturday Sat 1997-10-04 22:23:00 10:23:00 PM 22:23:00 get_date = "2006-12-07" SELECT COUNT (*) from T_get_video_temp Where
1. Calculate the maximum number of days in a January:
Calendar time=calendar.getinstance ();
time.clear ();
Time.set (calendar.year,year);//year is int
time.set (calendar.month,i-1);/Note that Calendar object defaults to January of 0
int Day=time.getactualmaximum (calendar.day_of_month);//Days of the Month
Note: Before using the Set method, you must clear it, otherwise many of the information will be inherited from the system current time
Conversion of 2.Calendar and
6.Java date computes the number of interval days between two arbitrary times (this comparison is common):
(1) The Calendar object is passed in:
public int getintervaldays (Calendar startday,calendar endday) ... {
if (Startday.after (endday)) ... {
Calendar cal=startday;
Startday=endday;
endday=cal;
}
Long Sl=startday.gettimeinmillis ();
long El=endday.gettimeinmillis ();
long EI=EL-SL; return
(int) (ei/(1000*60*60*24));
}
This article is suitable for primary readers
Chuck Allison is a software architect at the Family History Research division of the Church of Christ, Salt Lake City St. Latter Day Church headquarters. He has a Bachelor of Mathematics and a master's degree in mathematics. He has been programming since 1975, and since 1984 he has been engaged in the teaching and development of C language. His current interest is in object-oriented technology and its education. He is a member of the X3j16,ansi C + +
// ================================================ ==========================================// Name: ZYQ. WebControls. Cultural. DateTimePick. DateTimePickLabel// Asp. Net service control// Version: 1.0.0.0// Prepared By: Zhang Yuqing// Date: 2003.2.12// Email: raxzhang@sina.com// Note: The control and source code are only for the Asp. Net Forum of the "Computer World" developer club to learn how to develop Asp.net.// Developed on the serv
//==========================================================================
Name: Zyq. WebControls.Cultural.DateTimePick.DateTimePickLabel
asp.net service Control
Version: 1.0.0.0
Author: Zhang Yuqing
Date: 2003.2.12
Email:raxzhang@sina.com
Description: This control and source code is just for the "Computer World" developer Club asp.net forum to learn how to develop asp.net
Server-side controls. Do not use for commercial purposes without my consent.
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.