Author |
|
francesco Newbie
Joined: 06 June 2013
Online Status: Offline Posts: 14
|
Posted: 08 June 2013 at 1:38pm | IP Logged
|
|
|
Hi, with afterlogic php version and hmailserver i see that some mail have a wrong date, in particular 1/1/1970 but are order correct. For example: if i receive a mail now, the mail is the last but have 1/1/1970 as date.
What can i do?
Thank you
PS on outlook or other mail client the date is correct... i think is an error in the php code when it convert the date..possible?
|
Back to Top |
|
|
francesco Newbie
Joined: 06 June 2013
Online Status: Offline Posts: 14
|
Posted: 08 June 2013 at 5:20pm | IP Logged
|
|
|
I try to check where is the error. I found the function that send 1/1/1970, and is into DateTimeHelper.php:
public static function ParseInternalDateString($sDateTime)
{
$oDateTime = \DateTime::createFromFormat('d-M-Y H:i:s O', $sDateTime, \MailSo\Base\DateTimeHelper::GetUtcTimeZoneObject());
return $oDateTime ? $oDateTime->getTimestamp() : 0;
}
But i don't know if the problem is the string that receive or a problem in a function. I see that the correct date appear in this format "May 19, 17:39".
I don't know, i have a lot of issue with this webmail...i hope to help, and that someone help me...
|
Back to Top |
|
|
francesco Newbie
Joined: 06 June 2013
Online Status: Offline Posts: 14
|
Posted: 09 June 2013 at 3:04pm | IP Logged
|
|
|
Ok, i fix the bug by myself. The function ParseInternalDateString threw an exception when the date have the number of the day < 10. So I modify the code:
----------------------------------------------------------------------------
public static function ParseInternalDateString($sDateTime)
{
if (strlen(trim($sDateTime)) < 26){
$sDateTime = "0".trim($sDateTime);
}
$oDateTime = \DateTime::createFromFormat('d-M-Y H:i:s O', $sDateTime, \MailSo\Base\DateTimeHelper::GetUtcTimeZoneObject());
return $oDateTime ? $oDateTime->getTimestamp() : 0;
}
-------------------------------------------------------------------------------
Bye. (Igor let's call me if you looking for a debugger :-) )
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 10 June 2013 at 12:52am | IP Logged
|
|
|
We have already a few reports on this issue, and though the fix you've made looks correct, there's a simpler way - replace $sDateTime with trim($sDateTime) inside ParseInternalDateString function definition.
Quote:
Bye. (Igor let's call me if you looking for a debugger :-) ) |
|
|
Will definitely keep that in mind!
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|