Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 01-08-2005, 04:00   #1 (permalink)
Neal
Civilians

 
Default 01 Jan 1970

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.)
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 01-08-2005, 06:00   #2 (permalink)
Toby Inkster
Civilians

 
Default Re: 01 Jan 1970

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

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-08-2005, 07:00   #3 (permalink)
Gregory Toomey
Civilians

 
Default Re: 01 Jan 1970

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
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-09-2005, 15:00   #4 (permalink)
Richard
Civilians

 
Default Re: 01 Jan 1970

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.


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-09-2005, 17:00   #5 (permalink)
Toby Inkster
Civilians

 
Default Re: 01 Jan 1970

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

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-09-2005, 19:00   #6 (permalink)
Eric Jarvis
Civilians

 
Default Re: 01 Jan 1970

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"
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-10-2005, 07:00   #7 (permalink)
Matt Bradley
Civilians

 
Default Re: 01 Jan 1970

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
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 09:56.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 0.88617 seconds with 19 queries