Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Getting the Week of the Year

Name: Anonymous 2007-08-30 23:47 ID:Zig6EBTU

I'm trying to make a PHP-based site that archives by week, like Fark does. Thing is, I don't know how to query by week of the year.

How do I do that?

Name: Anonymous 2007-08-30 23:53 ID:P6wfNUmc

You select any record that has a time higher than the start of the Monday of that week and lower than the end of the Sunday of that week.

Name: Anonymous 2007-08-31 4:32 ID:Jl12X5sj

In each row of a table, I could keep the date of that week's Monday. The Monday is gotten when the row is inserted. Upon entering the site, the rows with the same date are queried, simplifying (and possibly expediating) the execution of the site.

The trick is in determining the Monday. I can find the week-number for a date: but how do I find the first date of a week-number?

Name: Anonymous 2007-08-31 4:38 ID:Jl12X5sj

It's >>3 again....

If I use WEEKDAY() with the date a row is inserted, I can just use the date of `date - WEEKDAY(date)' for the Monday I need.

Am I even REMOTELY correct?

Name: Anonymous 2007-08-31 5:19 ID:tLBhbOc5

Don't use php unless you enjoy being anally raped.

Name: Anonymous 2007-08-31 5:20 ID:8WOD+XMd

What DBMS are you using?

Name: Anonymous 2007-08-31 17:30 ID:Jl12X5sj

>>6
What's a DBMS?

>>5
Should I have expilictly stated that I'm using MySQL with PHP? I'm not being sarcastic: should I have?

Name: Anonymous 2007-08-31 17:38 ID:Heaven

>>4
wouldn't that give you sunday instead of monday?

Name: Anonymous 2007-08-31 17:39 ID:Jl12X5sj

0 is Monday, >>8.

Name: Anonymous 2007-08-31 17:41 ID:Heaven

>>9
then what is sunday? -1?
why would the second day of the week be 0?

Name: Anonymous 2007-08-31 18:03 ID:Jl12X5sj

Sunday is 6.

Name: Anonymous 2007-08-31 18:06 ID:wfyuO6d7

The first day of the week is Monday, unless you're a fag.

Name: Anonymous 2007-08-31 18:23 ID:Heaven

>>12
even wikipedia, which is full of eurofags, says:
Its name in Arabic, Armenian, Georgian, Greek, Hebrew, Persian, Portuguese and Syriac means "second day". Quakers also traditionally refer to Monday as "Second Day" eschewing the pagan origin of the English name "Monday". For similar reasons the official liturgical calendar of the Roman Catholic Church refers to Monday as "Feria II". (The Portuguese name for Monday reflects this, as do all the days' names except Saturday and Sunday: the Portuguese word for Monday is segunda-feira.)

Name: Anonymous 2007-08-31 18:25 ID:hR9a07va

>>13
those guys need to choke on dick and get with the program

Name: Anonymous 2007-08-31 19:57 ID:kAiOLaY8

Fuck history, having Sunday as first day of week just complicates things further.

In the United States of Retarded Standards, what week does the weekend belong to?

Name: Anonymous 2007-08-31 20:00 ID:Heaven

having Sunday as first day of week just complicates things further.
not as much as having sunday as the first day of the week for millenia and then deciding to make monday the first day of the week for no reason at all.

Name: Anonymous 2007-08-31 20:29 ID:kAiOLaY8

Well, it makes much more sense. Either Monday or Saturday should be the first day of the week. I.e. 1 week = workweek + weekend or weekend + workweek. Now, weekEND would suggest the first, i.e. Monday.

Choosing Sunday is as retarded as choosing Wednesday. I don't care what day God allegedly rested. Changing from Sunday to Monday was a much appreciated bugfix. US should update.

Name: Anonymous 2007-08-31 23:31 ID:/GTMimgR

>>17
sunday being part of the weekend instead of part of the workweek is a relatively recent change.

Name: Anonymous 2007-08-31 23:58 ID:GI+DGroh

>>18
I think you're mistaking it with saturday, perhaps?

Name: Anonymous 2007-09-01 1:02 ID:Heaven

>>19
no, saturday was the day of rest, sunday was just another weekday until the christians started meeting on the first day of the week.

Name: Anonymous 2007-09-01 2:06 ID:xfTs0BaX

I'm trying to make a PHP-based (...)

NO!

Name: Anonymous 2007-09-01 2:17 ID:wdyaEP7+

Fucking Americans.

Are you going to start crying about computers counting from 0 now?

Name: Anonymous 2007-09-01 2:24 ID:HVb63haB

>>22
Dijkstra says it's preferable.

Name: Anonymous 2007-09-01 2:38 ID:8OFOURXf

>>23
Dijkstra is right as always

Name: Anonymous 2007-09-01 5:03 ID:7uvlvGEq

>>1 is a stupid web developer who can't do maths for shit

Name: Anonymous 2007-09-01 10:05 ID:9N5zZg1X

>>24
nice id

Name: Anonymous 2007-09-01 18:58 ID:8OFOURXf

>>26
Thanks, You've got a pretty nice ID as well. Maybe I can take you out for coffee sometime? ;)

Name: Anonymous 2007-09-01 19:13 ID:nUMBIJ/B

STARBUCKS

Name: Chris Logan Hansen 2007-09-01 20:33 ID:7uvlvGEq

>>27
Why don't you have a seat over there ?

Name: Anonymous 2007-09-01 20:35 ID:Heaven

>>28

YOUR ID SAYS NUMB LOL

Name: Anonymous 2010-11-14 20:25

Name: Anonymous 2013-07-30 18:09

Lain

Don't change these.
Name: Email:
Entire Thread Thread List