Handling Dates

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
(1) Does PHP provide any way to handle dates prior to 1980?

I know there's problems with Microsoft Windows NT and all Windows
NT operating systems will allow a date prior to 1980 to be placed upon
a file, but it ends up not being able to display the date (probably an
Windows Explorer specific issue).

(2) I'm looking for for ways to store dates and process dates (dates only).
This probably ends up as a database specific issue, so I'm wondering
about handling dates (YYYY.MM.DD format) with databases. I don't
have any experience involving this, and the database I'm playing with
currently offers no date support at all (SQLite)... and from what I've
played with in the past, Windows tends to convert dates back and forth
between text and a number (causing a problem with dates prior to 1980
specifically with Windows Explorer).

Anyways, this is a pretty good topic I think. And I'd appreciate any
help or suggestions or comments about this topic.


Jim Carlock
Post replies to the group.

Re: Handling Dates

.oO(Jim Carlock)

Quoted text here. Click to load it

The beginning of the Unix epoch is 1970.

Recent PHP versions (>= 5.1.0) support negative timestamps, which allows
for dates between 1901 and 2038.

Quoted text here. Click to load it

Most databases have their own date types. In MySQL for example dates are
stored as YYYY-MM-DD in special DATE or DATETIME columns.

Quoted text here. Click to load it

What do you want to do actually? What does the Windows Explorer have to
do with PHP?


Re: Handling Dates

"Michael Fesser" wrote...
: What do you want to do actually? What does the Windows Explorer
: have to do with PHP?

Not sure that it has anything to do with PHP. I specifically noticed the
problem with Explorer. Was wondering if it was an OS issue and if
PHP dealt with it in some other way.

And a year or so ago, I extracted a file from a zipped package. The
file was dated a long time ago but when it came out of the archive,
Explorer didn't display a date upon the file. The unpacking program
seemed to handle the file well. Windows Explorer failed, failed though.

I was just playing around with dates trying to figure out how to get
a database to handle dates. I think it'll be pretty easy to use 3 or 4
32-bit integers to represent dates. Only need one to represent the
day of the year, and the other three should provide enough bits to
handle an ancient past. Wondering how many bits are needed to
handle the life of Earth. :-)

Still got some more playing to do. I personally have some files
dating back to about 1990 and earlier (America Online Beta Versions
(DOS), they called it ), and then there are some archived
files dated prior to 1980. The dates after Dec 31, 1979 read fine via
Windows Explorer. I didn't even have a computer until 1982 or 1983
(an Atari 400 and later a hand me down IBM PC Jr with a wireless
keyboard which got bad reviews in the magazines - the keyboard).

Just started wondering about dates and databases. PHP can handle
dates like birthdates dating back to 1890? And what type of database
someone uses to handle prehistoric dates?

The date upon the following file...
Thursday, January 01, 1970, 12:00:00 AM

The date upon the following file...
Monday, December 31, 1979, 11:59:00 PM

<shrug> Windows handles the dates okay. Explorer though... :-) Feel
free to download the files and look at the files or whatever. They're
just some gif images. I'm giving them away.

Jim Carlock

Site Timeline