How can I get 'day of week' for the 'Friday' only?

Aditya

I want the day of week for each friday that is coming from my date column in SQL Server.

What I tried so far is,

SELECT 
[EntryDate] AS 'Date', 
DATEPART(dw,[EntryDate]) AS 'Week' ,
CASE WHEN
DATEPART(dw,[EntryDate]) = DATEPART(dw,[EntryDate]) AND DATENAME(dw,[EntryDate]) = 'Friday'
THEN
DATENAME(dw,[EntryDate])
END AS 'DayName'
FROM [dbo].[EnergyDetails]

Output is:-

enter image description here

Can anybody please give some focus.

Thanks.

vhadalgi

pls try this:

SELECT 
Date,
DATEADD(DD,(7- DATEPART(DW,Date)),c.Date) as 'End Date',
DATENAME(DW,(DATEADD(DD,(6- DATEPART(DW,Date)),Date))) as 'DayName'
FROM TABLE_NAME;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I get one wallpaper for each day of the week?

From Dev

How can I get one wallpaper for each day of the week?

From Dev

How can I get a day off next week?

From Dev

Laravel or php I have a week number of a month and a day, how can i get the date of these..?

From Dev

How Can i get DateArray of current Running Week With Month a Day And Month in Asp.net C#

From Dev

How do I get what the Friday (day name ) 2 weeks from the present date

From Dev

How to Get Only Day Name or Number in a Week in JavaScript Date()

From Dev

How can I display the day of the week, (I have the highest value)?

From Dev

How to get the dates of the current monday, wednesday and friday of the current week in excel?

From Dev

for a date get the friday of the week ending

From Java

How can I get the DateTime for the start of the week?

From Dev

How can I get the previous week in Python?

From Dev

How can I get the previous week in Python?

From Dev

How can I construct a Locale with a custom first day of week?

From Dev

How can I determine whether a day lies within the last week or not?

From Dev

How can I check for a specific day of the week using NSDate in Swift?

From Dev

How can I clean up this code to convert a date into a day of the week?

From Dev

How can I set the day of the week as a variable in Swift?

From Dev

How can I change the first day of week in Swift

From Java

How do I get the day of week given a date?

From Dev

How do I get the Day of Week order to start with Monday

From Dev

How can I get an SQL query to display only entries for the last week?

From Dev

How Get Start Day of Week?

From Dev

How to find get week duration or week range from sunday to friday in php

From Dev

How to get first day of week when i know week number in ISO 8601

From Dev

Rails group_by_day working with specific day of the week "friday"

From Dev

Spinner contains week days, how can I select the default day depending on the device day

From Dev

Can I get a Jenkins trigger to run every first week day of every month?

From Dev

How to get the day of week in english not in chinese?

Related Related

  1. 1

    How can I get one wallpaper for each day of the week?

  2. 2

    How can I get one wallpaper for each day of the week?

  3. 3

    How can I get a day off next week?

  4. 4

    Laravel or php I have a week number of a month and a day, how can i get the date of these..?

  5. 5

    How Can i get DateArray of current Running Week With Month a Day And Month in Asp.net C#

  6. 6

    How do I get what the Friday (day name ) 2 weeks from the present date

  7. 7

    How to Get Only Day Name or Number in a Week in JavaScript Date()

  8. 8

    How can I display the day of the week, (I have the highest value)?

  9. 9

    How to get the dates of the current monday, wednesday and friday of the current week in excel?

  10. 10

    for a date get the friday of the week ending

  11. 11

    How can I get the DateTime for the start of the week?

  12. 12

    How can I get the previous week in Python?

  13. 13

    How can I get the previous week in Python?

  14. 14

    How can I construct a Locale with a custom first day of week?

  15. 15

    How can I determine whether a day lies within the last week or not?

  16. 16

    How can I check for a specific day of the week using NSDate in Swift?

  17. 17

    How can I clean up this code to convert a date into a day of the week?

  18. 18

    How can I set the day of the week as a variable in Swift?

  19. 19

    How can I change the first day of week in Swift

  20. 20

    How do I get the day of week given a date?

  21. 21

    How do I get the Day of Week order to start with Monday

  22. 22

    How can I get an SQL query to display only entries for the last week?

  23. 23

    How Get Start Day of Week?

  24. 24

    How to find get week duration or week range from sunday to friday in php

  25. 25

    How to get first day of week when i know week number in ISO 8601

  26. 26

    Rails group_by_day working with specific day of the week "friday"

  27. 27

    Spinner contains week days, how can I select the default day depending on the device day

  28. 28

    Can I get a Jenkins trigger to run every first week day of every month?

  29. 29

    How to get the day of week in english not in chinese?

HotTag

Archive