Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YearWeek #434

Closed
Ghalleb opened this issue Jun 5, 2013 · 6 comments
Closed

YearWeek #434

Ghalleb opened this issue Jun 5, 2013 · 6 comments
Milestone

Comments

@Ghalleb
Copy link

@Ghalleb Ghalleb commented Jun 5, 2013

It would be usefull to have a YearWeek function the same way we have a YearMonth one.

The result would be:

extract(year from field) * 100 
+ extract(week from field)
@timowest timowest closed this Jun 9, 2013
@timowest timowest reopened this Jun 9, 2013
@timowest timowest closed this Jun 9, 2013
@timowest timowest reopened this Jun 9, 2013
@timowest timowest closed this Jun 9, 2013
@timowest timowest reopened this Jun 9, 2013
@timowest timowest closed this Jun 9, 2013
@timowest timowest reopened this Jun 9, 2013
@timowest
Copy link
Member

@timowest timowest commented Jun 9, 2013

Sorry for the close/reopen switches.

@timowest
Copy link
Member

@timowest timowest commented Jun 9, 2013

YearWeek is now available as yearWeek().

@Ghalleb
Copy link
Author

@Ghalleb Ghalleb commented Jun 10, 2013

A question:

What will yearWeek for the 1st January will return?

Sometimes 1st January is in week 1 of week 52 or week 53...
This is because of the iso week definition(http://en.wikipedia.org/wiki/ISO_week_date)

For exemple 1 Jan 2005 is 2004 W53 but 1 Jan 2008 is 2008 W1.

Week function in SQL is always a little bit messy

@timowest
Copy link
Member

@timowest timowest commented Jun 10, 2013

The implementation is based on year * 100 + week.

I can try to implement it as an ISO compliant year week access instead.

@timowest timowest closed this Jun 10, 2013
@timowest timowest reopened this Jun 10, 2013
@Ghalleb
Copy link
Author

@Ghalleb Ghalleb commented Jun 10, 2013

I think the ISO compliant would be better.

@timowest
Copy link
Member

@timowest timowest commented Jun 26, 2013

Released in 3.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants