Re: [PHP] Dates before 1970

2006-04-17 Thread Richard Lynch
Call me crazy, but I think that:

$time = 0x; //largest INT possible
echo date('m/d/Y h:i:s a', $time);

would be very revealing.

On Thu, April 13, 2006 10:26 pm, Suhas wrote:
 This will definitely solve one way but still other is there,
 How to get that -ve number which starts at 1/1/1900 at 00:00 AM = 0

 I need to be able to convert back and forth as there are some
 calculations to be done on date field,

 But this is very interesting..
 Thx
 SP

 On 4/13/06, Rasmus Lerdorf [EMAIL PROTECTED] wrote:
 Suhas wrote:
  Hello,
 
  I have a project that deals with the date time stamps since 1900
 (and
  past), any suggestions about a good class that handles Date Time
  Format before 1970. I really like date() function and want
 something
  similar.

 date() uses Unix timestamps which on most Unix platforms goes from
 -MAX_INT to MAX_INT which means the date range is actually
 12:45:52 12/13/1901 to 07:14:07 01/18/2038.  So you might be able to
 get
 away with it.

 You can check it with:

 echo date(h:i:s m/d/Y,-2147483648);
 echo date(h:i:s m/d/Y, 2147483647);

 Windows, not being Unix, doesn't understand that the timestamp can
 be
 negative, although I think someone fixed that in PHP 5.  In my 11+
 years
 of PHP I have yet to run PHP on Windows, so I wouldn't know.

 -Rasmus



 --
 Contact @
 Suhas Pharkute.
 208 830 8915 (C)
 208 429 6943 (H)

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Dates before 1970

2006-04-17 Thread tedd

At 6:43 PM -0500 4/17/06, Richard Lynch wrote:
Call me crazy, but I think that:

$time = 0x; //largest INT possible
echo date('m/d/Y h:i:s a', $time);

would be very revealing.


H.

Is: 12/31/1969 06:59:59 pm

Yes, it is -- I remember what I was doing then. It was six months 
after I got out of the US Army.


And,

$time = -0x; //smallest INT possible
echo date('m/d/Y h:i:s a', $time);

Is: 12/13/1901 03:45:52 pm

Close to when I was born. :-)

Whereas,

$time = 0;
echo date('m/d/Y h:i:s a', $time);

Is: 12/31/1969 07:00:00 pm

But, what point is there in all this?

tedd


--

http://sperling.com

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



[PHP] Dates before 1970

2006-04-13 Thread Suhas
Hello,

I have a project that deals with the date time stamps since 1900 (and
past), any suggestions about a good class that handles Date Time
Format before 1970. I really like date() function and want something
similar.

Thanks in advance!
SP

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



Re: [PHP] Dates before 1970

2006-04-13 Thread Rasmus Lerdorf

Suhas wrote:

Hello,

I have a project that deals with the date time stamps since 1900 (and
past), any suggestions about a good class that handles Date Time
Format before 1970. I really like date() function and want something
similar.


date() uses Unix timestamps which on most Unix platforms goes from 
-MAX_INT to MAX_INT which means the date range is actually
12:45:52 12/13/1901 to 07:14:07 01/18/2038.  So you might be able to get 
away with it.


You can check it with:

echo date(h:i:s m/d/Y,-2147483648);
echo date(h:i:s m/d/Y, 2147483647);

Windows, not being Unix, doesn't understand that the timestamp can be 
negative, although I think someone fixed that in PHP 5.  In my 11+ years 
of PHP I have yet to run PHP on Windows, so I wouldn't know.


-Rasmus

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



Re: [PHP] Dates before 1970

2006-04-13 Thread Suhas
This will definitely solve one way but still other is there,
How to get that -ve number which starts at 1/1/1900 at 00:00 AM = 0

I need to be able to convert back and forth as there are some
calculations to be done on date field,

But this is very interesting..
Thx
SP

On 4/13/06, Rasmus Lerdorf [EMAIL PROTECTED] wrote:
 Suhas wrote:
  Hello,
 
  I have a project that deals with the date time stamps since 1900 (and
  past), any suggestions about a good class that handles Date Time
  Format before 1970. I really like date() function and want something
  similar.

 date() uses Unix timestamps which on most Unix platforms goes from
 -MAX_INT to MAX_INT which means the date range is actually
 12:45:52 12/13/1901 to 07:14:07 01/18/2038.  So you might be able to get
 away with it.

 You can check it with:

 echo date(h:i:s m/d/Y,-2147483648);
 echo date(h:i:s m/d/Y, 2147483647);

 Windows, not being Unix, doesn't understand that the timestamp can be
 negative, although I think someone fixed that in PHP 5.  In my 11+ years
 of PHP I have yet to run PHP on Windows, so I wouldn't know.

 -Rasmus



--
Contact @
Suhas Pharkute.
208 830 8915 (C)
208 429 6943 (H)

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



Re: [PHP] Dates before 1970

2006-04-13 Thread chris smith
 I have a project that deals with the date time stamps since 1900 (and
 past), any suggestions about a good class that handles Date Time
 Format before 1970. I really like date() function and want something
 similar.

If you're using a database at all, most of them will handle any sort of dates.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Dates then 1970

2003-11-03 Thread Mark McCulligh
What function(s) would you use if you want to take someone's birth day and
format it on display.

I have always used strtotime, then strftime but it doesn't work if someone
was born in 1939. strtotime returns -1.

What function would you use to take the input string 1939/11/23 and get
the timestamp so I can use functions like strftime or date.

Thanks,
Mark.

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



Re: [PHP] Dates then 1970

2003-11-03 Thread John W. Holmes
Mark McCulligh wrote:

What function(s) would you use if you want to take someone's birth day and
format it on display.
I have always used strtotime, then strftime but it doesn't work if someone
was born in 1939. strtotime returns -1.
What function would you use to take the input string 1939/11/23 and get
the timestamp so I can use functions like strftime or date.
You'll have to tear it apart and do the math youself. Current year minus 
the first four digits. If current month/day is less than month/day from 
string, then subtract one (hasn't reached birthday yet).

If you're storing these dates in a database, you can use your query to 
calculate the age (unless it used unix timestamps, also).

--
---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