Solutions for 1970 epoch date restriction

This is a discussion on Solutions for 1970 epoch date restriction within the PHP General forums, part of the PHP Programming Forums category; Hi, I have a table that includes 3 columns for day, month and year. Example: Day, Month, Year 11,Jan, ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-09-2003
Yc Nyon
 
Posts: n/a
Default Solutions for 1970 epoch date restriction

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
Reply With Quote
  #2 (permalink)  
Old 11-09-2003
John W. Holmes
 
Posts: n/a
Default Re: [PHP] Solutions for 1970 epoch date restriction

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
Reply With Quote
  #3 (permalink)  
Old 11-09-2003
David Otton
 
Posts: n/a
Default 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/...-c20a0526ce0b]
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:17 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0