![]() | ![]() | ![]() |
| |||||||
| Forums | Register | Groups | Awards | Arcade | Pets | T-Bucks / T-Store | Invite Your Friends | Blogs | Mark Forums Read |
| Web Design Forums and discussions on webdesign |
Web Design | |||||||||
|
|
|
|
| |||||
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Civilians | Just fielding ideas - what's a good explanation for a solitary random user using a PHP-driven database to get a date "01 Jan 1970" when it clearly is not the date? Discount the user's clock setings, please. Any other stupid errors, please mention. (This is not for my site, but I site I am visiting.) |
|
| | #2 (permalink) |
| Civilians | Neal wrote: > Just fielding ideas - what's a good explanation for a solitary random > user using a PHP-driven database to get a date "01 Jan 1970" when it > clearly is not the date? UNIX measures dates in the number of seconds since midnight on the 1st of January 1970. That's how dates are stored internally. So if you entered, say 0, or perhaps even NULL into the date column of a database, and then tried to read it, it would return 0 seconds after midnight on the 1st of January 1970. In fact, if you'd entered any number below 86400, it would still be some time on the 1st of January. (e.g. if you entered 7200, it would be 2am on 1 Jan 1970.) -- Toby A Inkster BSc (Hons) ARCS Contact Me ~ http://tobyinkster.co.uk/contact |
|
| | #3 (permalink) |
| Civilians | Neal wrote: > Just fielding ideas - what's a good explanation for a solitary random > user using a PHP-driven database to get a date "01 Jan 1970" when it > clearly is not the date? > > Discount the user's clock setings, please. Any other stupid errors, > please mention. (This is not for my site, but I site I am visiting.) Its the start of the Epoch. http://en.wikipedia.org/wiki/Unix_epoch gtoomey |
|
| | #4 (permalink) |
| Civilians | On Sat, 08 Jan 2005 09:39:04 +0000 Toby Inkster wrote: > Neal wrote: >> Just fielding ideas - what's a good explanation for a solitary random >> user using a PHP-driven database to get a date "01 Jan 1970" when it >> clearly is not the date? > UNIX measures dates in the number of seconds since midnight on the 1st > of > January 1970. That's how dates are stored internally. > So if you entered, say 0, or perhaps even NULL into the date column of > a > database, and then tried to read it, it would return 0 seconds after > midnight on the 1st of January 1970. > In fact, if you'd entered any number below 86400, it would still be > some > time on the 1st of January. (e.g. if you entered 7200, it would be 2am > on > 1 Jan 1970.) So to get a date earlier than 1/1/70 you'd have to enter a negative number? My database contains dates before 1970, how would you reference them? A dumb way of doing things. |
|
| | #5 (permalink) |
| Civilians | Richard wrote: > So to get a date earlier than 1/1/70 you'd have to enter a negative number? Bingo. > My database contains dates before 1970, how would you reference them? > A dumb way of doing things. How you reference them and how they are internally stored are two entirely different matters. Unless you're doing very low level programming, you simply use an API to query the date and get the date back in a useful format. You never even see the way it's stored internally, which might be in: - seconds since the 1st of January 1970 (which is what UNIX does[1]); or - hectonanoseconds since the 1st of January 1601 (which is what Windows does... yes, really!); or even - millifornights since Elvis Presley died (which no operating system of which I'm aware does, even though it would be pretty cool.) ____ [1] Incidentally, UNIX stores this as a 32-bit number, which means that on 19th January 2038 at 03:14:08 it will wrap around and become 20:45:52 on 13 December 1901. Ouch! Hopefully by then 32-bit computers will be obsolete and we'll be using 64-bit or 128-bit numbers to represent UNIX times. -- Toby A Inkster BSc (Hons) ARCS Contact Me ~ http://tobyinkster.co.uk/contact |
|
| | #6 (permalink) |
| Civilians | Toby Inkster usenet200501@tobyinkster.co.uk wrote: > > - millifornights since Elvis Presley died (which no operating > system of which I'm aware does, even though it would be pretty > cool.) > Create an OS that does that and I can find a market. Though it will also need to default to furlongs for distance, bushels for weight, and automatically ROT-13 any words that are associated with jbex or zbarl. OK so the newsgroup that works that way only has around 50 regular posters, but that's still a bigger customer base than some versions of Linux. -- eric www.ericjarvis.co.uk "live fast, die only if strictly necessary" |
|
| | #7 (permalink) |
| Civilians | Toby Inkster wrote: > Richard wrote: > - hectonanoseconds since the 1st of January 1601 (which is what > Windows does... yes, really!); or even So I guess the big installation size of Windows is simply a function of storing all the version / revision dates of the OS ;-) -- Matt Bradley "Myths which are believed in tend to become true" -George Orwell |
|
![]() |
| Bookmarks |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [MV] 1970 Jeep | laptops | MV List | 0 | 04-22-2006 00:54 |
| [MV] FS: 1970 M35A2 | mark@ehle.homelinux.org | MV List | 3 | 04-22-2006 00:40 |
| [MV] FS: 1970 M35A2 | mark@ehle.homelinux.org | MV List | 0 | 04-22-2006 00:39 |
| [MV] FS: 1970 AMG M35A2 | mark@ehle.homelinux.org | MV List | 0 | 04-22-2006 00:37 |
| Re: [MV] FS: 1970 M35A2 | mark@ehle.homelinux.org | MV List | 0 | 04-21-2006 23:46 |
![]() | ![]() | ![]() |