Re: TimestampToDate.inc - Convert a timestamp to a date! -
Firerfan - 29.12.2015
Because i did not want to take a look at the complete function and also i dont want to get a deeper look into it, here's a solution:
1) Open the Include File
2) Look for variable "MonthTimes" (should be line 16)
3) increase the first array dimension from 12 to 13
4) copy duplicate the last line so the end would look like this:
Код:
{ 31, 31, 2678400, 2678400 },
{ 31, 31, 2678400, 2678400 }
};
Now it should work. Its not the perfect solution but a temporary fix.
Excuse my grammar - Best regards from germany
Re: TimestampToDate.inc - Convert a timestamp to a date! -
Jeffry - 29.11.2016
In order to fix the "Array index out of bounds" issue change line 89:
Код:
if(day > MonthTimes[month][IsLeapYear(year)])
to:
Код:
if(day > MonthTimes[month-1][IsLeapYear(year)])
Re: TimestampToDate.inc - Convert a timestamp to a date! -
Shetch - 29.01.2017
When retrieving a timestamp from MySQL and converting it using your include, it spits out a 2017/02/01 date, even though it's 2017/01/29.
Here's a working fix/replacement:
https://github.com/Crayder/Time-Conversion
Re: TimestampToDate.inc - Convert a timestamp to a date! -
MerryDeer - 29.01.2017
So what better use this
https://github.com/Crayder/Time-Conversion or in this topic timestamp functions?
Re: TimestampToDate.inc - Convert a timestamp to a date! -
Jochemd - 04.02.2017
Quote:
Originally Posted by Shetch
When retrieving a timestamp from MySQL and converting it using your include, it spits out a 2017/02/01 date, even though it's 2017/01/29.
Here's a working fix/replacement: https://github.com/Crayder/Time-Conversion
|
You might want to bear in mind your timestamp is wrong.
Quote:
Originally Posted by MerryDeer
|
This one works fine.
Re: TimestampToDate.inc - Convert a timestamp to a date! -
Kwarde - 23.12.2017
Quote:
Originally Posted by Firerfan
Because i did not want to take a look at the complete function and also i dont want to get a deeper look into it, here's a solution:
1) Open the Include File
2) Look for variable "MonthTimes" (should be line 16)
3) increase the first array dimension from 12 to 13
4) copy duplicate the last line so the end would look like this:
Код:
{ 31, 31, 2678400, 2678400 },
{ 31, 31, 2678400, 2678400 }
};
Now it should work. Its not the perfect solution but a temporary fix.
Excuse my grammar - Best regards from germany
|
It did fix the bug from preventing to work in December - But it now gives one day too much (It returned December 24 while it is December 23).
Now I am not sure if this only occurs in December (I'll find out soon) but to fix thбt bug, Timestamp must be decreased with
259200 seconds instead of
172800
Re: TimestampToDate.inc - Convert a timestamp to a date! -
Jochemd - 29.12.2017
Quote:
Originally Posted by Kwarde
It did fix the bug from preventing to work in December - But it now gives one day too much (It returned December 24 while it is December 23).
Now I am not sure if this only occurs in December (I'll find out soon) but to fix thбt bug, Timestamp must be decreased with 259200 seconds instead of 172800
|
I guarantee you it only happens in December.
Re: TimestampToDate.inc - Convert a timestamp to a date! -
Kwarde - 29.12.2017
Yes I already figured that out

Instead I now use Timestamp -= 172800 again, and I added the next line at the end of the TimestampToDate function;
if (month == 12) day--;
And now everything is working fine so far