Number of the day in the year
Hi,
I have a requirement to add the number of the day in the year to the message and concatenate with HHMM as shown below
like this :1205001...12:HH,05:MM; 001(1st day of the year)
ex2: 0204365...02:HH;04:MM;DDD:365(last day of the year)
ex3: 0209236..02:HH;09:MM;DDD:236:(236th day of the year)...
How can i achieve this? any standard functionality?
please advise.
Regads
Hi ,
Is it the current system date you wanna concatenate? Anyways this can be achieved by message mapping using standard functions
input--------------------------------------------------------------------\
concat()--------> target field
currentdate()--->Transformdate(yyyy/MM/dd,hh:mm:DDD)----------------------/
If its not system date then you can input any field like "2012/01/02" or change the format of input date transformdate (the first field).
Regards
Anupam
Similar Messages
-
How to get a week number for the year using oracle sql query?
hi everyone,
i have the requirement to find the week number for the calender..
so that week number should start with 01 when the year starts and it should end with week end date(that is first saturday of the january month).. so next week number starts with sunday and ends with saturday ,continously.. in the end date of the year it should not be 'saturday' but week number should end with last date of the year.. again in the next year it should start with '01'.
for example:
01-JAN-13 tuesday 01
02-JAN-13 wednesday 01
03-JAN-13 thursday 01
04-JAN-13 friday 01
05-JAN-13 saturday 01
06-JAN-13 sunday 02
07-JAN-13 monday 02
26-DEC-13 thursday 52
27-DEC-13 friday 52
28-DEC-13 saturday 52
29-DEC-13 sunday 53
30-DEC-13 monday 53
31-DEC-13 tuesday 53
01-JAN-14 wednesday 01
02-JAN-14 thursday 01
how can i achieve this, can anyone please help me out on this..
i have a query that starts with 01 when year starts but it gives problem in the end of the year .. described below with a query..
select mydate,
to_char(mydate,'day') as weekday,
to_char(next_day(mydate,'sunday'),'iw') as week_num
FROM ( SELECT TRUNC (SYSDATE, 'yy') - 1 + LEVEL AS mydate
FROM dual
CONNECT BY LEVEL <= (SELECT TRUNC (ADD_MONTHS (SYSDATE, 24), 'yy')
- TRUNC (SYSDATE, 'yy')
FROM DUAL))
this query gives date, weekday and week_num for 2 years 2013 and 2014,
when i run this query ,at the end of the 2013 it gives the result as,
26-DEC-13 thursday 52
27-DEC-13 friday 52
28-DEC-13 saturday 52
29-DEC-13 sunday 01
30-DEC-13 monday 01
31-DEC-13 tuesday 01
01-JAN-14 wednesday 01
02-JAN-14 thursday 01
for dates 29 ,30,31st it should give 53 .. how can i achieve that using this this query .. can any one help me out on this please...
thanks,
pradeepI tried with the IW ...
it is giving week_id for the year.
select
mydate,
to_char(mydate,'day'),
case when mydate between trunc(mydate,'yyyy') and next_day(trunc(mydate,'yyyy'),'saturday')
then to_number(to_char(mydate,'yyyy')||to_char(trunc(mydate,'yyyy'),'iw'))
when mydate between next_day(trunc(mydate,'yyyy'),'saturday') and trunc(add_months(trunc(mydate,'yyyy'),12)-1,'d')-1
then to_number(to_char(mydate,'yyyy')||to_char(next_day(mydate,'sunday'),'iw'))
when mydate between trunc(add_months(trunc(mydate,'yyyy'),12)-1,'d') and add_months(trunc(mydate,'yyyy'),12)-1
then to_number(to_char(mydate,'yyyy')||to_char(trunc(add_months(trunc(mydate,'yyyy'),12)-1,'d')-1,'iw')+1) end as WEEK_ID
FROM ( SELECT TRUNC (SYSDATE, 'yy') - 1 + LEVEL AS mydate
FROM dual
CONNECT BY LEVEL <= (SELECT TRUNC (ADD_MONTHS (SYSDATE, 24), 'yy')
- TRUNC (SYSDATE, 'yy')
FROM DUAL
)) -
XSLT Mapping: how to calculate Week number of the year from given date
Hi,
I have input as date, i need to know the Week number from that date in XSLT Coding.
for Eg: if date is 29-12-2009 it should give 53rd week of the year.
All answers will be appreciated.
Regards,
MayankHi add this statement to your XSLT Mappping
<xsl:stylesheet version="1.0" xmlns:java="http://xml.apache.org/xslt/java" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="java">
and use <xsl:template name="GetDateInLocal" xmlns:cal="xalan://java.util.GregorianCalendar"> in XSLT Mapping , write your logic.
cheers,
Raj -
Number of a day of an year without saturday and sunday
Hi,
How can I get the number of the day of an year?
How can I remove, from this number the saturday and the sunday? Should I check day by day?
Thanks, bye bye.Or you can function NEXT_DAY, some math and table dual:
to_char(to_date(6,'j'),'Day') is NLS independent way of representing Sunday and to_char(to_date(5,'j'),'Day') is NLS independent way of representing Saturday.
NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day')) is first sunday >= start_date. NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) is last Sunday <= end_date. Therefore:
(NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 + 1 is number of Sunday's between start_date and end_date. Same way:
(NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 + 1 As a result, number of weekdays between start_date and end_date is:
end_date - start_date + 1 -((NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) -
NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 + 1 +
(NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 + 1) or
end_date - start_date - 1 -(NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) -
NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 -
(NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 or:
SELECT end_date - start_date - 1 -(NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) /
7 - (NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7
FROM DUAL; Now:
WITH t AS (
SELECT to_char(to_date(6,'j'),'Day') sunday,
to_char(to_date(5,'j'),'Day') saturday,
DATE '2009-01-01' start_date,
DATE '2009-12-31' end_date
FROM dual
SELECT end_date - start_date - 1 -(NEXT_DAY(end_date - 7,sunday) - NEXT_DAY(DATE '2009-01-01' - 1,sunday)) /
7 - (NEXT_DAY(end_date - 7,saturday) - NEXT_DAY(start_date - 1,saturday)) / 7
FROM t
END_DATE-DATE'2009-01-01'-1-(NEXT_DAY(END_DATE-7,SUNDAY)-NEXT_DAY(DATE'2009-01-0
261
SQL> SY. -
Dates showing up as day of the year vs. day and month
hi; on my work imac, for some reason dates are labeled as the number of the year (as in 64 March) vs. the day and month. it happens in Mail and assigning dates to files that were created.
anyone know how to fix this?
thx, charlieOpen the International pane of System Preferences, click on Formats, choose Customize to the right of Dates, and correct the formats.
(34004) -
Is pre-paid best for a phone I'll only use one month out of the year?
I have an old Motorola phone dating back to 2008. The contract with Verizon Wireless is long since expired and my recently graduated former college student son no longer needs it. I live overseas, but I still want to retain the number and have a phone to use when I'm home in the States each summer. I really can't see paying ~ $600/year (@ $50/mo for 12 months under the current plan) for a phone I will use only for a short time each year -- that one or two months in the summer when we make phone calls like mad. I don't need a data plan, because it's not a smart phone and I wouldn't access the internet using this phone even if it were possible. What is my lowest cost option for retaining the phone number so my friends can call me without changing their address books every time I'm home in America? Do I have to buy a new phone when the old one still works fine?
Prepaid is the way to go in your situation. However minutes expire on some plans monthly, so you would have to buy minutes every month to keep your number.
Just be sure to choose the best plan that allows you to keep your number for the year. -
To see the number of working days and leave of an employee for year
HI SAP GURUS,
I want to see the the number of working days and leave of all employees of the organisation for a year. Please tell me is there any report or any transaction code in sap to see the working days and leave for all employees.
Thanks & Regards
SurupaHi,
call transaction PT64.
Best Regards
Bernd -
Week of the year number appears out of sync with the day of week the week #
Using the querry below on on a table where the pdate value is a sequential list of dates on an Oracle 11 database the results show the week of the year number changes on the day of the week number 7 not the day of the week number 1. Is there a patch to fix this?
select
pdate,
to_char(pdate,'D') dow,
to_char(pdate,'Day') Day_name,
to_char(pdate,'WW') week_of_the_Year
from daily_period_tab
where pdate >= '07-jan-11'
and pdate <= '09-jan-11'
07-JAN-11 6 Friday 01
08-JAN-11 7 Saturday 02
09-JAN-11 1 Sunday 02Hi,
Independent of you NLS settings, you can do this:
SELECT TRUNC ( dt + 1
, 'IW'
) - 1 AS sunday
FROM table_x;The output in the sunday column will be the Sunday on or before dt. The "magic number" 1 indicates that your week starts 1 day before the ISO week, which starts on Monday.
Or if you want to use your NLS settings:
ALTER SESSION SET NLS_TERRITORY= 'AMERICA';
SELECT TRUNC ( dt
, 'DY'
) AS sunday
FROM table_x;
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using. -
Calculate the number of days in a year excluding Saturday and Sunday
Hi All,
I need to get the number of days in a year excluding Saturday and Sunday for HR module and then subtract the public holidays.
Can some let me know how this needs to be done while loading data from one infocube to another.
Is there any Function module for the same so that i can write any start routines.
And also is there any table available for Tcode-SCAL with which i can write any start routines.
Kindly help me as soon as possible.
Regards,
KumarHi Harish
Refer to the screenshot for Import and Export parameters
Code
FUNCTION ZBI_FM_GET_HOLIDAYS .
*"*"Local Interface:
*" IMPORTING
*" VALUE(DATE_FROM) TYPE SCAL-DATE DEFAULT SY-DATUM
*" VALUE(DATE_TO) TYPE SCAL-DATE DEFAULT SY-DATUM
*" VALUE(FACT_CAL) TYPE SCAL-FCALID DEFAULT SPACE
*" VALUE(ONLYFACT_DAYS) TYPE CHAR1 OPTIONAL
*" EXPORTING
*" REFERENCE(HOLIDAYS) TYPE I
*" TABLES
*" DAY_ATTRIBUTES STRUCTURE CASDAYATTR
*" EXCEPTIONS
*" FACTORY_CALENDAR_NOT_FOUND
*" HOLIDAY_CALENDAR_NOT_FOUND
*" DATE_HAS_INVALID_FORMAT
*" DATE_INCONSISTENCY
DATA: LT_DAY_ATTRIBUTES TYPE TABLE OF CASDAYATTR WITH HEADER LINE.
DATA: LV_LINES TYPE SY-SUBRC.
DATA: DATE1 LIKE DATE_FROM,
DATE2 LIKE DATE_TO.
*if from date is gt to date then interchange the dates and multiply the result with -1.
IF DATE_FROM GT DATE_TO.
DATE2 = DATE_FROM.
DATE1 = DATE_TO.
ELSE.
DATE1 = DATE_FROM.
DATE2 = DATE_TO.
ENDIF.
CALL FUNCTION 'DAY_ATTRIBUTES_GET'
EXPORTING
FACTORY_CALENDAR = FACT_CAL
* HOLIDAY_CALENDAR = ' '
DATE_FROM = DATE1
DATE_TO = DATE2
LANGUAGE = SY-LANGU
* IMPORTING
* YEAR_OF_VALID_FROM =
* YEAR_OF_VALID_TO =
* RETURNCODE =
TABLES
DAY_ATTRIBUTES = LT_DAY_ATTRIBUTES
EXCEPTIONS
FACTORY_CALENDAR_NOT_FOUND = 1
HOLIDAY_CALENDAR_NOT_FOUND = 2
DATE_HAS_INVALID_FORMAT = 3
DATE_INCONSISTENCY = 4
OTHERS = 5 .
IF SY-SUBRC = 0.
IF ONLYFACT_DAYS = 'X'.
DELETE LT_DAY_ATTRIBUTES WHERE FREEDAY EQ SPACE.
ELSE.
DELETE LT_DAY_ATTRIBUTES WHERE WEEKDAY LT 6.
ENDIF.
DESCRIBE TABLE LT_DAY_ATTRIBUTES LINES LV_LINES.
HOLIDAYS = LV_LINES.
* IF DATE_FROM GT DATE_TO.
* HOLIDAYS = HOLIDAYS * -1.
* ENDIF.
ELSEIF SY-SUBRC = 1.
RAISE FACTORY_CALENDAR_NOT_FOUND.
ELSEIF SY-SUBRC = 2.
RAISE HOLIDAY_CALENDAR_NOT_FOUND.
ELSEIF SY-SUBRC = 3.
RAISE DATE_HAS_INVALID_FORMAT.
ELSEIF SY-SUBRC = 4.
RAISE DATE_INCONSISTENCY.
ENDIF.
ENDFUNCTION. -
When my delegates are filling in a event form i have put together, a large number of them forget to change either the month or year on the date field. Is there a way to have a date field that has drop down boxes for day, month and year so they have to choose rather than a date been already on the screen??
ThanksHi Christopher,
The WEEKDAY function allows specifying either Sunday or Monday as the first day of the week:
WEEKDAY
The WEEKDAY function returns a number that is the day of the week for a given date. WEEKDAY(date, first-day)
 date: The date the function should use. date is a date/time value. The time portion is ignored by this function.
 first-day: An optional value that specifies how days are numbered.
Sunday is 1 (1 or omitted): Sunday is the first day (day 1) of the week and Saturday is day 7.
Monday is 1 (2): Monday is the first day (day 1) of the week and Sunday is day 7. Monday is 0 (3): Monday is the first day (day 0) of the week and Sunday is day 6.
But I think you are referring to the first day of the 'workweek', for which I do not see a means of defining a custom value.
Since you want to 'insert categories', though, you could easily define your own, using WEEKDAY(date) or WEEKDAY(date,1), plus an IF statement to return the category label appropriate to the day. Here's one for a Sunday to Thursday work week. Dates are in column A, the formula is in whichever column you want as the Category column. For the example, I've placed it in column B.
B2, and filled down: =IF(WEEKDAY(A)<6,"Work","Off")
The top table shows the weekday numbers returned for each day of the week for each of the three permitted values for the optional second argument. The bottom table shows the results from the formula above, used to define a category label for each date:
A10 was left blank intentionally, to determine if the lack of data resulted in an error. The Warning message, flagged by the blue 'warning' triangle, is "The formula uses a number in place of a date." The 'date' assigned to this numerical value of zero was a Friday, but I'm not certain when. Probably best to avoid extra rows with no date shown.
Regards,
Barry -
How can I view the day of the year for a date? For example, if August 15 is day 267. Thanks.
Hi Gregory,
If you don't mind having it as an event, you could make a new calendar and have an event on each day with the day number as it's title. I'd use an Applescript to do this myself.
Something like this (copy into Script Editor & click RUN):
set myYear to year of (current date)
set myDate to date ("1/1/" & myYear)
set myCount to 1
tell application "iCal"
make new calendar with properties {name:"My Day Numbers"}
repeat
set myDay to make new event at the end of events of calendar "My Day Numbers" with properties {summary:("Day " & myCount), start date:myDate, end date:(myDate + 1 * hours)}
set allday event of myDay to true
set myCount to myCount + 1
set myDate to myDate + 1 * days
if year of myDate is not myYear then exit repeat
end repeat
end tell
display dialog "'My Day Numbers' calendar added for " & myYear buttons {"OK"} default button 1
Best wishes
John M -
Get the number of working days based on factory calendr for a range of mont
Dear all,
We are using BI7.00 . In one of our reports we have the following requirement.
The range of months will be given in the selection screen for example 01.2008 to 11.2008, when the query is executed, i want system to calculate the number of working days for each month of the year (for what values provided in the selection field ) and display the same. i.e., as mentioned below.
Month days.
01.2008 22
02.2008 18
03.2008 25 etc., Kinldy provide steps for adopting the same. If it can be adopted only through customer exit also provide the code and parameters that has to be used.
Regards,
M.Mhi,
Try the following logic to find out the no.of working days in a month based on your calendar.
parameters : mny(6). " input format should be yyyymm
data : d1 like sy-datum,
d2 like sy-datum,
d3 like sy-datum,
v_nds type i.
concatenate mny '01' into d1.
CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
EXPORTING
DAY_IN = d1
IMPORTING
LAST_DAY_OF_MONTH = d2
EXCEPTIONS
DAY_IN_NOT_VALID = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
do 30 times.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
CORRECT_OPTION = '+'
DATE = d1
FACTORY_CALENDAR_ID = ' A' " your factory calendar ID
IMPORTING
DATE = d3.
if d1 = d3.
d1 = d1 + 1.
v_nds = v_nds + 1.
else.
d1 = d3.
endif.
if d3 ge d2.
exit.
endif.
enddo.
write : 'No of working days ', v_nds.
hope it helps...
regards,
raju -
Hi experts,
*I have a date that has been stored in three separated columns in a oracle data base 10g:
-number of week: for example 30. (range 1-53)
-number of the day: for example 5. (range 1-7).
-year : for example 2010.
*i need to write a SQL code which concate and convert this three columns to one signle date in the format dd/mm/yyyy.
*This a concrete example:
-input:
number of the day: 2, number of the week :23, year 2010.
-ouput:
07/06/2010
Any idea will be welcome
Best regards.Hi,
Here's one way :
alter session set nls_date_language = "english";
alter session set nls_territory = "america";
WITH date_parts AS (
select 2010 yr, 23 wk, 2 dy from dual union all
select 2010 yr, 39 wk, 2 dy from dual
SELECT next_day(to_date('0101'||yr,'DDMMYYYY')-7, 'SUN') - 1
+ 7*wk
+ dy
AS dt
FROM date_parts;You might have to make some adjustments due to your nls settings. -
i returned my old ipod and ordered a new one a few days ago and i was never given a tracking number for the new one that is being shipped
Go to the Apple Store webpage and in the upper right go to Account and select Track an Order. There you will find the status of your order. You only get a tracking order when the items ships.
-
The old calender iOS6, in the year view, it shows how much busy I am in a day by indicating the color intensity. But the new calendar year view is totally useless!!! also too bright!! Why apple does this?? What is the way to revert the calendar back???
Unfortunately, that's the way the cookie crumbles nowadays. Sir Jony Ive's GUI design for iOS7 has been met with much skepticism (to say the least). But until the company sees the compelling need for an adjustment or reversal, it "ain't happenin' ". So amble over to the feedback page ( http://www.apple.com/feedback/ ) and make your displeasure known to the company, OR make it known by not purchasing its products. Because as long as the iGadgets continue selling as fast as they can make them, they will see no need for change.
BTW, do note you are NOT talking to Apple here. This is just a user-to-user forum.
Edit: for now, you can also try out any of the alternate calendaring apps available in the App Store.
Maybe you are looking for
-
How do I use my old iMac as a third display on my new MacBook pro?
I have both an iMac 2006 and a new 2011 MacBook Pro. I would like to use the old iMac as a second, prhaps third, monitor. How do I tturn my perfectly good iMac into a regular monitor? Also, within my setup, I have an extra 19" vga display and a new Y
-
Printing Strings on same line questions
I need to know how to print the same number of _ (underscores) as there are letters in a given string. I already have the int of the number of characters in the string but how do i use that to print the same number of underscores in ONE line, not ver
-
What are the systems variables in oracle
Hai All In oracle what is called system variable and types of system variables Good answer hepls me Thanks & Regards Srikkanth.M
-
Unable to edit quota in pipe line performance management
Hi Guys, When I am accessing quota planning from PPM and clicking on edit button in action it is taking me to quota planning screen but nothing is enabled?Where could i have gone wrong?Is any setting missing/authorization issue?Am logged with Sales p
-
I just upgrade to firefox 4 There are a few issues but on my toolbar the refresh button now appears on the very left side of the tool bar. My "back" and "forward" button are still where they always been -- on the left side. Is it possible to move the