logo
Tags down

shadow

Django Query same week last year


By : Steven F.
Date : October 18 2020, 03:08 PM
To fix this issue Django 1.11 added a week filter. Can you use that?
If not, you might be able to look at the source code and cherry pick it.
code :


Share : facebook icon twitter icon

SQL Query- How to find the difference from last week of last year and first week of current year


By : Herm
Date : March 29 2020, 07:55 AM
With these it helps You need to use the DATEDIFF function to compute the difference between dates in SQL Server: http://msdn.microsoft.com/en-us/library/ms189794.aspx.
It would help if you could provide a simplified schema in order to guide you to the actual query you need.

How to convert year and week of year obtained from MongoDB query into Joda datetime?


By : user3640585
Date : March 29 2020, 07:55 AM
I hope this helps . ISO 8601
Joda-Time follows the ISO 8601 standard in defining weeks.
code :
int yearNumber = 2015;
int weekNumber = 0;

LocalDate firstWeekSunday = null;
LocalDate firstOfYear = new LocalDate ( yearNumber, 1, 1 );
if ( firstOfYear.getDayOfWeek ( ) == DateTimeConstants.SUNDAY ) {
    firstWeekSunday = firstOfYear;
} else { // ELSE not Sunday.
    firstWeekSunday = firstOfYear.minusDays ( firstOfYear.getDayOfWeek ( ) );  // Joda-Time uses standard ISO 8601 weeks, where Monday = 1, Sunday = 7.
}
LocalDate sunday = firstWeekSunday.plusWeeks ( weekNumber );

DateTimeZone zone = DateTimeZone.forID ( "America/Montreal" );
DateTime dateTime = sunday.toDateTimeAtStartOfDay ( zone );
System.out.println ( "Sunday-based week of year:" + yearNumber + " week: " + weekNumber + " starts: " + sunday + "." );
System.out.println ( "Adjusted to time zone: " + zone + " is: " + dateTime + "." );
Sunday-based week of year:2015 week: 0 starts: 2014-12-28.
Adjusted to time zone: America/Montreal is: 2014-12-28T00:00:00.000-05:00.

Fiscal year starts in April but I want to use ISO week numbers 14 of 2018 calendar year to week 13 of 2019 calendar year


By : Simon Griffiths
Date : March 29 2020, 07:55 AM
With these it helps You could subtract 90 days before calculating the week number. (Assuming the start is April 1 instead of January 1.)
Or, have a named cell indicating the first day of the Fiscal Year and then use that to calculate the week number, something like:
code :
([Report date] - [1st day of F'Year]) + 7 = [Week Number]

PHP/Laravel 5.4/Carbon - sustainable way to parse week of year, considering for year to year week number variances


By : user2131352
Date : March 29 2020, 07:55 AM
hope this fix your issue Just use $formattedDate = $date->format('o').'-W'.$date->format('W');

Query for # of new user per week - how to order by year/week?


By : user207927
Date : March 29 2020, 07:55 AM
With these it helps I think you'll find the function YEARWEEK() helpful, not only for the grouping, but also for the ordering.
Also, your use of DATE_FORMAT() doesn't look right, because you're outputing the %e, which is the day of the month, yet you're grouping by week?
code :
SELECT DATE_FORMAT(created_at, '%Y %b %v') AS date, COUNT(*) AS total
FROM users
GROUP BY YEARWEEK(created_at)
ORDER BY YEARWEEK(created_at) DESC;
shadow
Privacy Policy - Terms - Contact Us © soohba.com