21493 Posts in 5784 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 596 Views |
-
date.ago wrong calculation?

12 November 2010 at 1:14am
Hi,
in the Date-Class there is a method Ago().
But i guess its calculating not correct.Today we have: 2010-11-11
In DB the date is: 2010-11-10So, $datum.Ago should write "1 day ago" but I get "2 days ago".
Or am I understanding it wrong?
thanks -
Re: date.ago wrong calculation?

21 November 2010 at 3:21am
ok, i was using the wrong class.
i did:
$date = new Date();
$date->setValue($this->Created);
return $date->Ago();But the method setValue() of the Date-Class is creating a Date in format "Y-m-d".
So hour, minute and second of $this->Created are considered as 00:00:00.Instead I had to use the class SS_Datetime
$date = new SS_Datetime();
$date->setValue($this->Created);
return $date->Ago();maybe this is useful for anyone.
One more notice: In german it should be formulated "vor 9 Tagen".
Mayby this is diffucult to do with translation, because "Tage" is the correct plural for "Tag".
But in this case it has to be "vor 9 Tagen".
| 596 Views | ||
|
Page:
1
|
Go to Top |

