Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | The %W date specifier in strftime should be measured from the first Monday of the year. Ticket #758. (CVS 1806) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | version_2 |
Files: | files | file ages | folders |
SHA1: |
135e5447f66fcd8ec4350c81707a2e8d |
User & Date: | drh 2004-07-18 22:25:15.000 |
Context
2004-07-18
| ||
23:03 | Use only unsigned characters in upper() and lower(). Ticket #708. (CVS 1807) (check-in: f9b2aa8f8a user: drh tags: version_2) | |
22:25 | The %W date specifier in strftime should be measured from the first Monday of the year. Ticket #758. (CVS 1806) (check-in: 135e5447f6 user: drh tags: version_2) | |
21:14 | Min() and max() ignore NULL values. Ticket #800. (CVS 1803) (check-in: 223521c04e user: drh tags: version_2) | |
Changes
Changes to src/date.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | ** This file contains the C functions that implement date and time ** functions for SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** This file contains the C functions that implement date and time ** functions for SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** ** $Id: date.c,v 1.16.2.1 2004/07/18 22:25:15 drh Exp $ ** ** NOTES: ** ** SQLite processes all times and dates as Julian Day numbers. The ** dates and times are stored as the number of days since noon ** in Greenwich on November 24, 4714 B.C. according to the Gregorian ** calendar system. |
︙ | ︙ | |||
796 797 798 799 800 801 802 | sprintf(&z[j],"%02d.%03d",s,ms); j += strlen(&z[j]); break; } case 'H': sprintf(&z[j],"%02d",x.h); j+=2; break; case 'W': /* Fall thru */ case 'j': { | | | > > | | | 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | sprintf(&z[j],"%02d.%03d",s,ms); j += strlen(&z[j]); break; } case 'H': sprintf(&z[j],"%02d",x.h); j+=2; break; case 'W': /* Fall thru */ case 'j': { int n; /* Number of days since 1st day of year */ DateTime y = x; y.validJD = 0; y.M = 1; y.D = 1; computeJD(&y); n = x.rJD - y.rJD; if( zFmt[i]=='W' ){ int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */ wd = ((int)(x.rJD+0.5)) % 7; sprintf(&z[j],"%02d",(n+7-wd)/7); j += 2; }else{ sprintf(&z[j],"%03d",n+1); j += 3; } break; } case 'J': sprintf(&z[j],"%.16g",x.rJD); j+=strlen(&z[j]); break; case 'm': sprintf(&z[j],"%02d",x.M); j+=2; break; case 'M': sprintf(&z[j],"%02d",x.m); j+=2; break; |
︙ | ︙ |
Changes to test/date.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2003 October 31 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing date and time functions. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2003 October 31 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing date and time functions. # # $Id: date.test,v 1.7.2.1 2004/07/18 22:25:16 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl proc datetest {tnum expr result} { do_test date-$tnum [subst { execsql "SELECT coalesce($expr,'NULL')" |
︙ | ︙ | |||
91 92 93 94 95 96 97 | datetest 3.4 {strftime('%j','2003-10-31 12:34:56.432')} 304 datetest 3.5 {strftime('%J','2003-10-31 12:34:56.432')} 2452944.024264259 datetest 3.6 {strftime('%m','2003-10-31 12:34:56.432')} 10 datetest 3.7 {strftime('%M','2003-10-31 12:34:56.432')} 34 datetest 3.8 {strftime('%s','2003-10-31 12:34:56.432')} 1067603696 datetest 3.9 {strftime('%S','2003-10-31 12:34:56.432')} 56 datetest 3.10 {strftime('%w','2003-10-31 12:34:56.432')} 5 | | > > > > > > > > > > > > > | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | datetest 3.4 {strftime('%j','2003-10-31 12:34:56.432')} 304 datetest 3.5 {strftime('%J','2003-10-31 12:34:56.432')} 2452944.024264259 datetest 3.6 {strftime('%m','2003-10-31 12:34:56.432')} 10 datetest 3.7 {strftime('%M','2003-10-31 12:34:56.432')} 34 datetest 3.8 {strftime('%s','2003-10-31 12:34:56.432')} 1067603696 datetest 3.9 {strftime('%S','2003-10-31 12:34:56.432')} 56 datetest 3.10 {strftime('%w','2003-10-31 12:34:56.432')} 5 datetest 3.11.1 {strftime('%W','2003-10-31 12:34:56.432')} 43 datetest 3.11.2 {strftime('%W','2004-01-01')} 00 datetest 3.11.3 {strftime('%W','2004-01-02')} 00 datetest 3.11.4 {strftime('%W','2004-01-03')} 00 datetest 3.11.5 {strftime('%W','2004-01-04')} 00 datetest 3.11.6 {strftime('%W','2004-01-05')} 01 datetest 3.11.7 {strftime('%W','2004-01-06')} 01 datetest 3.11.8 {strftime('%W','2004-01-07')} 01 datetest 3.11.9 {strftime('%W','2004-01-08')} 01 datetest 3.11.10 {strftime('%W','2004-01-09')} 01 datetest 3.11.11 {strftime('%W','2004-07-18')} 28 datetest 3.11.12 {strftime('%W','2004-12-31')} 52 datetest 3.11.13 {strftime('%W','2007-12-31')} 53 datetest 3.11.14 {strftime('%W','2007-01-01')} 01 datetest 3.12 {strftime('%Y','2003-10-31 12:34:56.432')} 2003 datetest 3.13 {strftime('%%','2003-10-31 12:34:56.432')} % datetest 3.14 {strftime('%_','2003-10-31 12:34:56.432')} NULL datetest 3.15 {strftime('%Y-%m-%d','2003-10-31')} 2003-10-31 proc repeat {n txt} { set x {} while {$n>0} { |
︙ | ︙ |