Convert oracle time to characters, intercept characters

Represents year: y represents the last digit of the year yy represents the last 2 digits of the year yyy represents the last 3 digits of the year yyyy uses 4 digits to represent the year
Represents month: mm uses 2 digits to represent the month; mon uses a short form such as 11 Month or nov; month uses the full name such as November or november
to represent day: dd represents the day of the month; ddd represents the day of the year; dy is abbreviated for the day of the week, such as Friday or fri; day is the full day of the week For example, Friday or friday




means hour: hh 2 digits represent the hour in hexadecimal; hh24 2 digits represent the hour and 24 hours

; minute: mi 2 digits represent

the minute; second: ss 2 digits represent the second hexadecimal

representation Quarterly: q One ​​digit indicates the quarter (1-4)


Time range in 24-hour format: 00:00:00-23:59:59

Time range in 12-hour format: 1:00:00-12:59 :59 For

example:

select to_char(sysdate,'yy-mm-dd hh24:mi:ss') from dual 

select to_date('2005-12-25,13:25:59','yyyy-mm-dd,hh24: mi:ss') from dual to

intercept characters:
select substr('123456',0,1) from dual//0: start interception position, 1: intercept length, the result is 1

select instr('1234561',' 1',2) from dual//Get the subscript of the second 1 in the string,result is 7

-------------------------------------------------- ------------
Current time minus 7 minutes
select sysdate,sysdate - interval '7' MINUTE from dual
Current time minus 7 hours
select sysdate - interval '7' hour from dual
Current time minus 7 days
select sysdate - interval '7' day from dualCurrent
time minus July
timeselect sysdate,sysdate - interval '7' month from dualCurrent
time minus 7
yearsselect sysdate,sysdate - interval '7' year from dual
time interval multiplied by a number
select sysdate,sysdate - 8*interval '7' hour from dual


original: https://www.cnblogs.com/gaojing/archive/2008/11/07/ 1328657.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326081552&siteId=291194637