How to get the week of the year in American Standard
HelloI know that it might be a repetitive question, but has not found a convincing solution to him in any of the previous threads. I'm looking for a function (user defined, if someone has already written it) go the week of the year, American Standard. i.e., The week should begin on Sunday and end on Saturday (and NOT from Monday to Sunday)
03/01/2010 - should be the beginning of the 1st week of 2010... 10/01/2010 will be the beginning of the second week and so on
04/01/2009 - should be the beginning of the 1st week of 2009... 11/01/2009 will be the beginning of the second week and so on.
Does anyone have a function that takes a date as input and returns back the week of the year in the above format? Any help is greatly appreciated.
Thank you
You can add a day to your date in order to manipulate the weeks;
with t as (
select to_date('02/01/2010','dd/mm/yyyy') dt from dual union all
select to_date('03/01/2010','dd/mm/yyyy') from dual union all
select to_date('09/01/2010','dd/mm/yyyy') from dual union all
select to_date('10/01/2010','dd/mm/yyyy') from dual)
select dt, to_char(dt, 'Day') dy, to_char(dt+1, 'iw') wk
from t;
DT DY WK
----------- --------- --
02/01/2010 Saturday 53
03/01/2010 Sunday 01
09/01/2010 Saturday 01
10/01/2010 Sunday 02
Tags: Database
Similar Questions
-
How to get the year and month of a whole year
Hello
I have a list of selection and when the user selects the list values are like this 201101,201102,201103
I tried like this
declare
T_DATE varchar2 (25);
Start
because me in 1.12 loop
Select TO_CHAR (ADD_MONTHS (SYSDATE, + 1), "YYYYMM") in the double T_DATE;
dbms_output.put_line (V_DATE);
end loop;
end;
But its bad and I can not get clear idea where to change the code
Thanks and greetings
Srikkanth.MSrikkanth.M wrote:
HelloI have a list of selection and when the user selects the list values are like this 201101,201102,201103
If you want to list for the current year from Jan 201101,201102, 201103... 201112, then try this
DECLARE v_Date VARCHAR2(25); n_month NUMBER; BEGIN SELECT extract (MONTH FROM sysdate) INTO n_month FROM dual; FOR i IN 1..12 LOOP SELECT TO_CHAR(ADD_MONTHS(SYSDATE, (i-n_month)), 'YYYYMM') INTO v_date FROM dual; dbms_output.put_line(v_date); END LOOP; END;
Vivek L
-
How to get the year of Date data
Hi all
I have the following scenario:
County - Date - Code
5 DS - 01/09/2009
5 DS - 15/01/2009
5 LO - 21/01/2009
1. IT - 02/09/2009
5 DS - 03/09/2009
5 LO - 04/09/2009
4 DS - 05/09/2009
5 - IS - 06/09/2009
5 DS - 07/09/2009
5 - IS - 08/09/2009
3 DS - 09/09/2009
5 DS - 10/09/2009
5 LO - 11/09/2009
2 DS - 12/09/2009
5 DS - 01/09/2010
5 LO - 02/09/2010
4 DS - 03/09/2010
How can I only CDA data for 2009 and one year for 2010... Is meant by CDA 2009 data until the day of the date for example, if its 9 March today... TBE outcome will bring full jan, Feb and until the 9th day of March ' 09 and full jan, Feb and until the 9th day of March 10
Thank you
Published by: [email protected] on March 9, 2010 23:03
Published by: [email protected] on March 9, 2010 23:06Something like:
where dt <= trunc(dt,'YYYY')+(trunc(sysdate,'DD')-(trunc(sysdate,'YYYY'))
"Dt" corresponding to your date column.
-
How to get the Date, month, year of the DateTimePicker
Hi, I am using the DateTimePicker.
There are several question about this command:
1. how to get the Date, month and year?
-With the help of myDateTime.value, I get this string ' Wed May 08 14:45 ICT 2013 '-> I have to manually analyze this? Because I need in format yyyy/mm/dd. Or can set the format of dateTimePicker.value?
2 format on dateTimePicker self (on the user interface) is d/m/YY, I can't change to another format?
Thank you
dateTimePicker.value return a QDateTime not a string.
https://developer.BlackBerry.com/Cascades/reference/bb__cascades__datetimepicker.html#property-value
See more:
https://developer.BlackBerry.com/Cascades/reference/QDateTime.html#date
https://developer.BlackBerry.com/Cascades/reference/QDate.html
You can get
day = dateTimePicker.value.date().day() month = dateTimePicker.value.date().month() year= dateTimePicker.value.date().year() dateYYYYMMDD = dateTimePicker.value.date().toString(Qt::ISODate) dateYYYYMMDD2 = dateTimePicker.value.date().toString("YYYY/MM/DD") dateYYYYMMDD3 = dateTimePicker.value.toString("YYYY/MM/DD")
-
How to get the last day of the week?
HII
I can get the week number of calendar for a given date using
SELECT to_char (to_date('04/04/2011','MM/DD/YYYY'), 'WW') FROM dual
can any body tell me, how to get the last day of the week?
and the answer should be: 04/08/2011(8th april)
Thank you
San
Published by: sandeep9 on April 4, 2011 03:50Perhaps this...
SQL> select trunc(sysdate,'WW')+6 from dual; TRUNC(SYSDATE,'WW')+ -------------------- 08-APR-2011 00:00:00 SQL>
-
How to get the date of end of week max and its rows of a table
Hello
This table how to get this line by id - name (id and the name of the composite key) whose date is the date of last weekend (last Saturday).Table [temp2] id name dt 123 a 2-mar-2010 124 b 1-feb-2010 125 c 3-apr-2010 123 a 13-mar-2010 125 c 13-mar-2010 123 a 12-feb-2010
for example, suppose to have IDs 123 values date February 12, 2010, 13-mar-2010 this date falls on the last Saturday 13-mar-2010, how to get the value of the line on Saturday last for all the unique id and the name?
So I wrote this but probably there a few traps...
Here I have spent in the in clause 4 last weekend dates manually (although either has been calculated by programming) in front.select id,name,dt from (select id,name,dt,max(dt) over(partition by id,name) as max_date from temp2) t where dt=t.max_date and dt in ('3-apr-2010' ,'27-mar-2010','20-mar-2010','13-mar-2010')
Thank youHere's another option:
SELECT * FROM ( SELECT ID , NAME , MAX(CASE WHEN TO_CHAR(DT,'DY','NLS_DATE_LANGUAGE=ENGLISH') = 'SAT' THEN DT END) AS DT FROM TEMP2 GROUP BY ID, NAME ) WHERE DT IS NOT NULL
It is always useful to provide the following information:
1. oracle version (SELECT * FROM V$ VERSION)
2. examples of data in the form to CREATE / INSERT commands.
3. expected results
4 explanation of the expected results (alias "business logic")
5. use.tags for #2 and #3. See FAQ (Link on top right side) for details.
-
How to get the 'DAY' based on the territory of current account held a number between
Hi all
Looks like I'm at the end of my intelligence here but how to get the 'DAY' based on the territory of current account with a number between 1 and 7? Oracle has functions to extract the day of the week, but I can't find the other way around.
I need a way to know that the number '3' on the database with NLS_TERRITORY = AMERICA means a 'Tuesday' or the number '2' on a database with NLS_TERRITORY = GERMANY means "Tuesday" as well.SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Release 11.2.0.3.0 - 64bit Production PL/SQL Release 11.2.0.3.0 - Production CORE 11.2.0.3.0 Production TNS for Linux: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - Production SQL> alter session set nls_territory=AMERICA; Session altered. SQL> select to_char (sysdate, 'D') from dual; T - 3 SQL> alter session set nls_territory=GERMANY; Session altered. SQL> select to_char (sysdate, 'D') from dual; T - 2
Hope I am clear enough.
And wish you all a happy new year :)
Kind regards
SmailUse the format "IW" to get the date of Monday and the format "DAY" to get the "first day of the week. Then compare dates to see if they are identical.
ALTER SESSION SET NLS_TERRITORY = 'AMERICA'; SELECT TRUNC(SYSDATE-LEVEL, 'IW') "Monday", TRUNC(SYSDATE-LEVEL, 'DAY') "NLS First day of week", MOD(TRUNC(SYSDATE-LEVEL, 'IW') - TRUNC(SYSDATE-LEVEL, 'DAY') + 7, 7) "1 if day 1 = SUN, 0 if MON" FROM DUAL CONNECT BY LEVEL <= 7; Monday NLS First day of week 1 if day 1 = SUN, 0 if MON --------- --------------------- -------------------------- 31-DEC-12 30-DEC-12 1 24-DEC-12 30-DEC-12 1 24-DEC-12 23-DEC-12 1 24-DEC-12 23-DEC-12 1 24-DEC-12 23-DEC-12 1 24-DEC-12 23-DEC-12 1 24-DEC-12 23-DEC-12 1 alter session set nls_territory = 'FRANCE'; SELECT TRUNC(SYSDATE-LEVEL, 'IW') "Monday", TRUNC(SYSDATE-LEVEL, 'DAY') "NLS First day of week", MOD(TRUNC(SYSDATE-LEVEL, 'IW') - TRUNC(SYSDATE-LEVEL, 'DAY') + 7, 7) "1 if day 1 = SUN, 0 if MON" FROM DUAL CONNECT BY LEVEL <= 7; Monday NLS First day of week 1 if day 1 = SUN, 0 if MON -------- --------------------- -------------------------- 31/12/12 31/12/12 0 24/12/12 24/12/12 0 24/12/12 24/12/12 0 24/12/12 24/12/12 0 24/12/12 24/12/12 0 24/12/12 24/12/12 0 24/12/12 24/12/12 0
Or it could be simpler:
ALTER SESSION SET NLS_TERRITORY = 'AMERICA'; WITH DATA AS (SELECT LEVEL INPUT_DAY FROM DUAL CONNECT BY LEVEL <= 7) SELECT INPUT_DAY, TO_CHAR(TRUNC(SYSDATE, 'Day')+INPUT_DAY-1, 'DAY') "Day label" from data; INPUT_DAY Day label --------- ------------------------------------ 1 SUNDAY 2 MONDAY 3 TUESDAY 4 WEDNESDAY 5 THURSDAY 6 FRIDAY 7 SATURDAY alter session set nls_territory = 'FRANCE'; WITH DATA AS (SELECT LEVEL INPUT_DAY FROM DUAL CONNECT BY LEVEL <= 7) SELECT INPUT_DAY, TO_CHAR(TRUNC(SYSDATE, 'Day')+INPUT_DAY-1, 'DAY') "Day label" from data; INPUT_DAY Day label --------- ------------------------------------ 1 MONDAY 2 TUESDAY 3 WEDNESDAY 4 THURSDAY 5 FRIDAY 6 SATURDAY 7 SUNDAY
-
How to get the maximum number of days in a month?
How to get the maximum number of days in a month?
I use a dateField. where I can get the month. Now, I want to get the maximum number of days in a month.
How can I get it?
Please help me. and thanks in advance... []
NET. RIM. Device.API.util
Class DateTimeUtilitiesgetNumberOfDaysInMonth (int month, int year)
Returns the number of days in the specified monthIt took me like 10 seconds to find it in the API, I guess you spent more time writing the post...
-
1. I upgraded my comp to Windows 7, Ultimate because I need to use many XP programs. What I've discovered, is the virtual XP Mode is not the same thing as XP regular and many programs do not run properly. Particularly theAudio out to lunch and MS GS Wavetable is not available in XP Mode.
2 - I end up having to buy another XP-Professional and installed in the same notebook. I have to turn off the laptop restart and select the Windows 7 to XP operating system. All old programs work fine under XP.
3 - I continued looking for a fix for the XP Audio Mode or virtual. Almost 2 years now, I can not find such a simple solution.
4. today, I found something on the Microsoft RDP Audio driver. What is the reason? Anyone know?
5. are there available MS drivers or resources?
I'm not interested in the commercial programs or attempts to scan my computer. MS sold Windows 7 that can run XP so I think that Microsoft is responsible for fixing.
Thanks in advance,
VT
Windows XP mode - 7: how to get the Realtek Audio Drivers with GS Wavetable outside normal? Instead of RDP Audio driver!
Hello
The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the Windows Virtual PC and XP Mode Forums.
http://social.technet.Microsoft.com/forums/en-us/w7itprovirt/threads
-
How to get the format YYYYMM, regardless of the month
Hello, I want to be able to get the year months '201401' format and 201402 regardless of what month is only for the current year.
Select to_char (Trunc (add_months (sysdate-2), 'MM'), "YYYYMM") of the double
output:
201409
But if I move to the next month and use the same command, the output displays 201410.
So basically how I would change the query to select the format of yearmonth from Jan Feb 2014
Hello
You can do this by truncating the sysdate for the current year:
TO_CHAR (trunc (sysdate, 'YEAR'), "YYYYMM"); - 201401
TO_CHAR (add_month (trunc (sysdate, 'YEAR'), 1), "YYYYMM"); - 201402
This help you?
Cheerz,
Stako
-
How to get the 6th element of a C.V. value column
Hi all
I use Oracle Business Intelligence 11.1.1.7.131017.
I have a column with the following formula: C.V. ("Tickets". "Number of tickets"), but since we want to only show the values advocated by the past 6 months and which is an accumulative column, we added the rank function in the filter and placed as: grade (C.V. ("Tickets". " Number of tickets')) < = 6 and for the final formula, we need the minimum value that is placed in 6th place...
My problem is how to get the value assigned to this position?
Here's the column values:
30719 (value I pretend-> min)
31357
32025
32595
33652
34616 (I also use this value-> max)
Any idea on how to get the value placed on tier 6?
Thanks for the help and have a good week.
Kind regards
Frederico.
I found a solution (poor, but it works)...
As a minimum I want is always located in the row = 6 I put a case when row = 6, then returns the value I'm pretending, else return 0, so after that I need only the max of all values, as they are 0 or the value that I'm pretending, like this:
MAX (CASE WHEN (GRADE (C.V. ("Tickets". "Number of tickets')) = 6) THEN of C.V. (FILTER ("Tickets"." Number of tickets' using 'status '. ((("" Resolved "="Resolvido")) END ELSE 0)
I want to thank you all for the help, normally I post in the forum of the ADF but its good to know I can get a lot of support here as well...
Many thanks to all,
Frederico.
-
How to get the last day of a month for every 2 months for a given period?
Hello
Can is it some please let me know how to get the last day, last day of the week, the weekend last day, last Monday, one month for every 2 months for a given period?
Thanks in advance.
Try the below
SELECT LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))) lastday.
BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'SAT '.
SO LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-1
WHERE TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'Sun '.
THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-2
Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
END as lastweekday,
BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') IN ('Sam', 'SUN')
THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
-(TO_NUMBER (TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))),' from)) - 1).
END as lastweekendday,
BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'MY
THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
Of OTHER NEXT_DAY (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), "LUN")-7
END AS lastmonday
FROM (SELECT SYSDATE startdate,
SYSDATE + 300 enddate
THE DOUBLE)
CONNECT BY LEVEL<=>=>
-
How to get the date for the first Monday of each month
Dear members,
How to get the date for the first Monday of each month.
I wrote the following code
SELECT decode (to_char (trunc (sysdate + 30, 'MM'), 'DAY'), 'MONDAY', trunc (sysdate + 30, 'MM'), NEXT_DAY (trunc (sysdate + 30, 'MM'), "LUN")) FROM DUAL
But he looks at complex bith.
Abhishek
Published by: 9999999 on 8 March 2013 04:30Use the IW format - it will make independent NLS solution. And all you need is truncated 7th day of each month using IW:
select sysdate current_date, trunc(trunc(sysdate,'mm') + 6,'iw') first_monday_the_month from dual / CURRENT_D FIRST_MON --------- --------- 08-MAR-13 04-MAR-13 SQL>
Here is the list of the first Monday of the month of this year:
with t as( select add_months(date '2013-1-1',level-1) dt from dual connect by level <= 12 ) select dt first_of_the_month, trunc(dt + 6,'iw') first_monday_the_month from t / FIRST_OF_ FIRST_MON --------- --------- 01-JAN-13 07-JAN-13 01-FEB-13 04-FEB-13 01-MAR-13 04-MAR-13 01-APR-13 01-APR-13 01-MAY-13 06-MAY-13 01-JUN-13 03-JUN-13 01-JUL-13 01-JUL-13 01-AUG-13 05-AUG-13 01-SEP-13 02-SEP-13 01-OCT-13 07-OCT-13 01-NOV-13 04-NOV-13 FIRST_OF_ FIRST_MON --------- --------- 01-DEC-13 02-DEC-13 12 rows selected. SQL>
SY.
-
How to get the date in the exact day in the field when another?
Hello
Please help me how to get the day of the week using another date field.
In fact, a field (week_day) has 1,2,3,4,5,6,7 here 1-, 2 - KILL like this.
another field has the date. After this date, go to this particular week and need to pick up the date of the Etiquettemois above. It should be this week there himself.
Thanks in advance!
Kind regards
Florian...
Published by: Florian on October 29, 2010 03:07Maybe it's
select trunc(date_field,'D') + week_field - 1 from table
-
How to get the text have the same effect as the video?
Hello
For the first time post here, but I wonder how to get the text of the titles have the same effect as the video behind her.
For my video, I use 'bad tv' and other effects such as Gaussian that obviously changes the appearance of video, creating the look of VHS. However, I then inserted text via the title, but it normally appears. How can I make this text have the same effects as the video behind it?
A friend told me I might need to add text to the video first, then do the effects, I have not tried, but wonder if there is an easier way, as this would require me to restart.
EDIT: That's what I'm looking for. https://youtu.be/7_2PHQI89dI?t=24s The text has the same effect as the video.
Thank you
One way is to create a clip made up based on the title and the original clip. Then apply the effect.
Another way is to use an adjustment layer.
Good luck.
Russ
Maybe you are looking for
-
What is the last program in Safari
Telstra change their e-mail program and suggested that the minimum programme of Safari is greater than 10.0, please tell us the latest version of Safari. I thought it was Colin 9.2
-
Cannot call the lync to Skype user
Hi team, Recently, we have activated Lync - Skype Interop. We submitted the provisional application of PIC. It has been months since we submitted our request and we have made the necessary changes in the lync2013 Server also. When I type my lync cont
-
Satellite P850-132 - sleep & Charge does not work
It's my script Own P850-132 ("sleep and charge" support)Changed hard drive SSD (samsung 830 265gt) Tried to get the PS3 controller & mic to load during sleepDidn t work. Noticed that didn t of pop-up window show "sleep and Charge" for those but showe
-
Can not log on to Windows Server 2012 R2 Essentials
Hi all. I have a big problem. I am running Windows Server 2012 R2 Essentials. I wanted to disable UAC, and for this I changed "EnableLUA" from 1 to 0 in the registry editor. I restarted the computer and when I log in with my admin account, it is said
-
I am running Windows XP on an old Dell 8100 and connect to my router with a Netgear N600 Wireless Dual Band USB adapter. The adapter stops frequently. Is there some settings in Windows XP, which is the cause? The adapter turns off intermittently for