© Copyright 2014, Oracle and/or its affiliates. Then WeekDay returns 5, which corresponds to Thursday. To find the week number of a given date adate, you can use this formula: 1 + FLOOR ( (adate - fiscalyearbegin (adate)) / 7 ) which finds how may days have passed since the beginning of the fiscal year, dvides by 7 to get the number of completed weeks (0-52), and adds 1 to get the number of the week in progress. (Assume the current date is Wednesday, July 5, 2009.)įirst the DateAdd function adds one day to the current date, resulting in a date of Thursday, July 6, 2009. WITH t AS (SELECT TODATE ('07-07-2016', 'dd-mm-rrrr') d FROM DUAL) SELECT TOCHAR (d, 'w') week, TOCHAR (d, 'd') dayno, TOCHAR (d, 'Day') Day FROM t WEEK DAYNO DAY - 1 5 Donnerstag 1 row selected. The DayName function extracts the name of the day of the week from a given date. W - Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh. WeekDay is most often used with the DayName function. The system returns the number of the day of the week, from 1 to 7, as shown here: You need to multiple the IW number by 7 which you can convert to a date with the day of year mask. If the Locale INI option offers no value, the system defaults to USD (United States/English). SQL> However, it's easy enough to generate a range for the the IW week number. If you omit this parameter, the system checks the Locale INI option. The default is the current date.Įnter a valid date format that describes the format used by your entry in the Date parameter. The system assumes your entry is in the format specified by the Format parameter. Use this function to determine the day of the week in a given date and return the value as a number. You are here: Function Reference > Alphabetical Listing > W > WeekDay WeekDay
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |