Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Support for dates before 1900

Posted on 2010-01-06
9
Medium Priority
?
629 Views
Last Modified: 2012-06-22
What's the best way to support dates before 1900 in php?
0
Comment
Question by:R7AF
  • 4
  • 3
  • 2
9 Comments
 
LVL 12

Expert Comment

by:jet-black
ID: 26190496
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 26190587
What version of PHP do you have?
0
 
LVL 13

Author Comment

by:R7AF
ID: 26190635
We're using 5.2.6 at the moment.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 111

Expert Comment

by:Ray Paseur
ID: 26190643
Some of the PHP calendar functions might be helpful.  Example:
http://us3.php.net/manual/en/function.juliantojd.php
0
 
LVL 12

Accepted Solution

by:
jet-black earned 2000 total points
ID: 26190645
Also, you can just use MYSQL functions.
The DATETIME type is used when you need values that contain both date and time information. MySQL retrieves and displays DATETIME values in YYYY-MM-DD HH:MM:SS format. The supported range is 1000-01-01 00:00:002 to 9999-12-31 23:59:592.

http://dev.mysql.com/doc/refman/5.0/en/datetime.html
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 26190687
MySQL functions - what a great idea!  Throw the UNIX timestamp issues under the bus!
0
 
LVL 13

Author Comment

by:R7AF
ID: 26190952
Yeah except we use Postgres - but I get the idea! ;-)
0
 
LVL 12

Expert Comment

by:jet-black
ID: 26191098
@Ray_Paseur
Thanks for your comment :)
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 26191155
You're more than welcome.  It's an elegant solution - great date coverage, easy to understand, all the SQL functions - total winner.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question