[Include] TimestampToDate.inc - Convert a timestamp to a date!
#61

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
Reply
#62

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)])
Reply
#63

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
Reply
#64

So what better use this https://github.com/Crayder/Time-Conversion or in this topic timestamp functions?
Reply
#65

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
Посмотреть сообщение
So what better use this https://github.com/Crayder/Time-Conversion or in this topic timestamp functions?
This one works fine.
Reply
#66

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
Reply
#67

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.
Reply
#68

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)