Jump to content

Archived

This topic is now archived and is closed to further replies.

theOlster

Problems handling really old dates in PHP

Recommended Posts

Hi - I'm currently writing a family tree website and are having problems with really old dates.  [quote]The following code:$return = date("l d F Y", mktime(0, 0, 0, 1, 1, 1234));
echo "$return";[/quote] Returns:[quote]Thursday 01 January 1970[/quote]Any ideas?

Share this post


Link to post
Share on other sites
As far as I know, the mktime() function gives you seconds from the epoch, which on your system is 01/01/1970 so it won't go any earlier than this without some calculation somewhere.

Have you done a search on these forums?  I just did a few searches and came up with a few really useful results... [url=http://www.phpfreaks.com/forums/index.php/topic,89933.0.html]Here's one[/url] for a start

Regards
Huggie

Share this post


Link to post
Share on other sites
There is a class called adodb. You call on it in your script and it will handle old dates. Try googling it or I will post link when I find it.

Share this post


Link to post
Share on other sites
OK here is the file. I hope I can do this whithout getting in trouble if Iam not suppose to I am sorry and you may just delete this.

Use it like so

[code]<?php
require('includes/adodb-time.inc.php');

$startdate = adodb_date("d-M-Y", adodb_mktime(0,0,0,1,1,1869));
?>[/code]

Ray

[attachment deleted by admin]

Share this post


Link to post
Share on other sites
Thanks Guys for all your help...
More info can be found on ADOdb here: [url=http://phplens.com/phpeverywhere/node/view/16]http://phplens.com/phpeverywhere/node/view/16[/url].

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.