Wordpress doesn't allow me to post in really old dates (year 1800)
I'm making a timeline in Wordpress, and I'm trying to make a post with the date January 12, 1800, but Wordpress doesn't allow me. Apparently, it doesn't let me post anything before the year 1970开发者_JAVA技巧. Is there any way to fix it?
PHP (the programming language WordPress is written in) uses a unix timestamp, which is the number of seconds since the 1st January 1970. This means that you can't use dates before that date, as that's "the beginning of time" according to PHP.
Sorry if that wasn't the answer you wanted :(
I'm fairly sure this isn't a Wordpress problem, more specifically a PHP problem which has led to Wordpress dealing with it.
This excerpt is taken from the PHP Manual:
The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer). However, before PHP 5.1.0 this range was limited from 01-01-1970 to 19-01-2038 on some systems (e.g. Windows).
So it may not be a problem with Wordpress itself, you may need to get in touch with someone at Wordpress about the problem, perhaps they can implement PHPs calendar extension.
Here are two solutions I came up with:
http://studiohyperset.com/wordpress-old-dates-historical-pre-1969-pre-1970-timestamp-function/3102
If all your dates are going to be in the 1800s, perhaps you can configure Wordpress to show the date in 2 digit format and stick "18" before it.
Some people claim to be able to use pre-1970 dates, though the bug is still offically open for 3.0: WordPress › Support » Bug with backdated post before 1 January 1970 - wp2.8 It's alleged that the problem is the se of negative time stamps, which some server OS's can't handle.
Could a custom field be used for the year earlier than 1970 and while printing the "current" day and month?
You can put the date into a custom field and display that instead and you could sort by that custom field as well, so the end result wouldn't be any different.
You can use Custom Fields to store the date, and show that in place of the_date or the_time calls.
精彩评论