what is the maximum future date of an SS_Datetime field in a model??
I try to set "9999-31-12 23:59:00" and "2099-31-12 23:59:00" via YAML fixture file but both values do not work.
"2029-12-11 23:59:00" works fine. hmmm.
thanks!
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
I try to set "9999-31-12 23:59:00" and "2099-31-12 23:59:00"
There is no 31st month.
The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.
http://dev.mysql.com/doc/refman/5.1/en/datetime.html
Sorry, wrote it down the wrong way.
now, I try to set "2039-12-31 23:59:00" but that does not work. I guess it's some 32bit unix timestamp issue. Could the default SS date parser be an issue here?
I have no problem to save or parse that kind of date. Did you check your database and tried to insert the date via phpMyAdmin? May be it's a formatting issue with DateField.
OK, got it fixed. here is how:
# when setting the date value to an SS_Datetime field by string (like "2039-12-31 23:59:00") the setValue method of SS_Datetime converts this string into a unix timestamp using strtotime. That timestamp is used to create a formatted string ('Y-m-d H:i:s') representing the date. but the timestamp seems to have some limitation (see http://www.tareeinternet.com/forum/knowledgebase/53-detailed-timestamp-information-tutorial.html)
# so I extended the SS_Datetime class and overwrote the setValue() method. This allows me to use the php DateTime class (since php 5.2) to create the formatted string ('Y-m-d H:i:s') and set the objects value directly.
# now I use the extended "eXSS_Datetime" classes in my models