Re: [sqlite] First Day of Week Inconsistency

2013-06-19 Thread Michael Black
Oops...forgot to add what you want.

   %U The week number of the current year as a decimal number,
range  00  to  53,
  starting  with the first Sunday as the first day of week 01.
See also %V and
  %W.

And this one:
   %V The ISO 8601:1988 week number of the current year as a decimal
number, range
  01  to  53,  where  week 1 is the first week that has at least
4 days in the
  current year, and with Monday as the first day of the week.
See also %U  and
  %W. (SU)

But SQLite doesn't implement those.


-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Denis Burke
Sent: Wednesday, June 19, 2013 11:21 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] First Day of Week Inconsistency

The built-in function strftime properly (imho) responds to the '%w' command
for day of week with Sunday as day 0.

e.g. -  strftime ('%w','2013-06-19')
->  3

But the built-in function for returning week of the year treats weeks as
though they begin on Monday, not Sunday:
e.g.
strftime ('%W','2013-06-19')
-> 24
strftime ('%W','2013-06-17')
-> 24
strftime ('%W','2013-06-16')
-> 23


It seems to me these useful functions are inconsistent.  Is it possible to
modify %W to treat Sunday as the first day of the week?

Thanks,
Denis Burke
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] First Day of Week Inconsistency

2013-06-19 Thread Simon Slavin

On 19 Jun 2013, at 5:20pm, Denis Burke  wrote:

> It seems to me these useful functions are inconsistent.

They are inconsistent with one-another.  But both functions are implemented to 
the standards, correctly as far as lots of POSIX-based computing is done.  It’s 
annoying but it’s correct.  Sorry.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] First Day of Week Inconsistency

2013-06-19 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 19/06/13 09:20, Denis Burke wrote:
> Is it possible to modify %W to treat Sunday as the first day of the
> week?

Traditionally strftime %W uses Monday to start each week while %U uses
Sunday.  It looks like SQLite doesn't implement the latter.

Roger

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlHB29kACgkQmOOfHg372QTxwQCfc3qGW5PtGljBm/rvgEOGVtA/
DzwAoI6cIiZ+SzMmX7NE2gcwEfDR0w2W
=y1z6
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] First Day of Week Inconsistency

2013-06-19 Thread Michael Black
Those are unrelated questions.day of week has nothing to with the start
of a week.

>From the standard strftime man page which has been around for decades.


   %w The  day  of  the week as a decimal, range 0 to 6, Sunday
being 0.  See also
  %u.
   %W The week number of the current year as a decimal number,
range  00  to  53,
  starting with the first Monday as the first day of week 01.


-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Denis Burke
Sent: Wednesday, June 19, 2013 11:21 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] First Day of Week Inconsistency

The built-in function strftime properly (imho) responds to the '%w' command
for day of week with Sunday as day 0.

e.g. -  strftime ('%w','2013-06-19')
->  3

But the built-in function for returning week of the year treats weeks as
though they begin on Monday, not Sunday:
e.g.
strftime ('%W','2013-06-19')
-> 24
strftime ('%W','2013-06-17')
-> 24
strftime ('%W','2013-06-16')
-> 23


It seems to me these useful functions are inconsistent.  Is it possible to
modify %W to treat Sunday as the first day of the week?

Thanks,
Denis Burke
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] First Day of Week Inconsistency

2013-06-19 Thread Denis Burke
The built-in function strftime properly (imho) responds to the '%w' command
for day of week with Sunday as day 0.

e.g. -  strftime ('%w','2013-06-19')
->  3

But the built-in function for returning week of the year treats weeks as
though they begin on Monday, not Sunday:
e.g.
strftime ('%W','2013-06-19')
-> 24
strftime ('%W','2013-06-17')
-> 24
strftime ('%W','2013-06-16')
-> 23


It seems to me these useful functions are inconsistent.  Is it possible to
modify %W to treat Sunday as the first day of the week?

Thanks,
Denis Burke
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users