3373 Posts in 998 Topics by 712 members
|Go to End|
8 March 2011 at 3:46am
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.
10 March 2011 at 6:16am
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'.
10 March 2011 at 8:45pm
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?
10 March 2011 at 9:51pm
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.
10 March 2011 at 11:15pm Last edited: 10 March 2011 11:18pm
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
|Go to Top|