... example has to work with any given date.
First of all: Get this week's dates and days:
SELECT
DATE( DATE_ADD( NOW( ) , INTERVAL 0 - WEEKDAY( NOW() ) DAY ) ) AS ThisDate,
DAYNAME( DATE_ADD( NOW( ...
... AS SecondsElapsed
FROM StaffActivities s
WHERE WEEKDAY(s.DateTimeCreated)=0
AND YEARWEEK(s.DateTimeCreated)=YEARWEEK(NOW()) - $w_value
AND s.StaffUserID='STRING_TO_REPLACE_PER_ITERATION'
) ...
... ARE: --
-- 2012-04-27 10:00:00 -- is a Friday
-- 2012-04-28 11:00:00 -- is a Saturday
-- 2012-04-29 12:00:00 -- is a Sunday
DATE_ADD(
givenDate,
INTERVAL (
6 - weekday(givenDate)
) DAY
) ...
Why?
I recently made a joomla module that displays the lastest members to signup. It goes a little further and counts activated accounts for the past day, week, month and year (the below examples count ...
... and room booking system). But I do get given a weekday and the start date of the week...
WITH tblDifference AS
(
SELECT
t1.*,
ROW_NUMBER() OVER (ORDER BY t1.Date ASC, t1.Start ASC, t1.Room ...
... WEEKDAY(s.DateTimeCreated) WHEN 0 THEN 'Monday' WHEN 1 THEN 'Tuesday' WHEN 2 THEN 'Wednesday' WHEN 3 THEN 'Thursday' WHEN 4 THEN 'Friday' WHEN 5 THEN 'Saturday' ELSE 'Sunday' END AS ActivityDay,
DATE(s.DateTimeCreated) ...
... sd.[SetId] = @setId
AND dateadd(d, tt.[WeekDay] - 1, @baseDate) = @GivenDate
AND wm.[WeekNumber] = @weekNumber
AND tt.[SiteId] = @siteId
AND upper(sd.[Descrip]) not like 'ADDITIONAL TIMETABLE%'
...
So I find myself searching the web for a way of producing an outlook-style calendar within Business Intelligence Development Studio (BIDS). Weekdays along the top and then dates inside. Additionally ...
... WEEKSTRUCTURE WHERE StartDate BETWEEN DATEADD(day, -6, @specifiedDate) AND DATEADD(day, 1, @specifiedDate))
SELECT
@specifiedDate AS 'GivenDate',
dateadd(d, tt.[WeekDay] - 1, @baseDate) AS 'Date',
datename(weekday, ...
We use cookies to improve your experience on our website. By browsing this website, you agree to our use of cookies. Read more about our Privacy Policy.