[PHP] Solutions for 1970 epoch date restriction

2003-11-09 Thread YC Nyon
Hi,

I have a table that includes 3 columns for day, month and year. Example:
Day, Month, Year
11,Jan, 1974
4,Sep, 1921
...
...

I need to construct a query where users can specify a starting date.
Currently, I stuck in mktime function became of the 1970 epoch problem. It
gives an error for dates before 1970.
Anyone has  a solution?


Regards
Nyon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Solutions for 1970 epoch date restriction

2003-11-09 Thread John W. Holmes
YC Nyon wrote:
I have a table that includes 3 columns for day, month and year. Example:
Day, Month, Year
11,Jan, 1974
4,Sep, 1921
...
...
I need to construct a query where users can specify a starting date.
Currently, I stuck in mktime function became of the 1970 epoch problem. It
gives an error for dates before 1970.
Anyone has  a solution?
Why are you using three separate columns? What database are you using?

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Solutions for 1970 epoch date restriction

2003-11-09 Thread David Otton
On Mon, 10 Nov 2003 01:41:15 +0800, you wrote:

I have a table that includes 3 columns for day, month and year. Example:
Day, Month, Year
11,Jan, 1974
4,Sep, 1921

That would be your problem - you should be using your database's native date
type.

I need to construct a query where users can specify a starting date.
Currently, I stuck in mktime function became of the 1970 epoch problem. It
gives an error for dates before 1970.
Anyone has  a solution?

[assumes mysql]

http://www.mysql.com/doc/en/Date_and_time_types.html

SELECT * FROM table WHERE start_date  '1969-08-25';

[for anyone who's interested, Raymond Chen's excellent journal had a short
article on various Windows timestamps:
http://blogs.gotdotnet.com/raymondc/permalink.aspx/99c54993-5c5e-45b9-95c1-c20a0526ce0b]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Solutions for 1970 epoch date restriction

2003-11-09 Thread Javier Muniz
If you can't change your database for some reason, for instance if it's a
legacy system or other large systems rely on that table format, look into
PEAR's Date class, it can probably help you out.

-Javier

-Original Message-
From: David Otton [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 09, 2003 4:00 PM
To: YC Nyon
Cc: php
Subject: Re: [PHP] Solutions for 1970 epoch date restriction


On Mon, 10 Nov 2003 01:41:15 +0800, you wrote:

I have a table that includes 3 columns for day, month and year. 
Example: Day, Month, Year 11,Jan, 1974
4,Sep, 1921

That would be your problem - you should be using your database's native date
type.

I need to construct a query where users can specify a starting date. 
Currently, I stuck in mktime function became of the 1970 epoch problem. 
It gives an error for dates before 1970. Anyone has  a solution?

[assumes mysql]

http://www.mysql.com/doc/en/Date_and_time_types.html

SELECT * FROM table WHERE start_date  '1969-08-25';

[for anyone who's interested, Raymond Chen's excellent journal had a short
article on various Windows timestamps:
http://blogs.gotdotnet.com/raymondc/permalink.aspx/99c54993-5c5e-45b9-95c1-c
20a0526ce0b]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php