mysql timestamps - Unknown123 - 03.09.2011
stock date return 0 and timestamp return 0, why?
pawn Код:
stock date(days, months, years)
{
new string[128], timestamp, hours, minutes, seconds;
gettime(hours, minutes, seconds);
format(string, sizeof(string), "SELECT UNIX_TIMESTAMP('%d-%02d-%02d %02d:%02d:%02d')", years, months, days, hours, minutes, seconds);
mysql_query(string);
mysql_store_result();
timestamp = mysql_fetch_int();
mysql_free_result();
return timestamp;
}
stock timestamp(timestamp) //not finished
{
new string[128];
format(string, sizeof(string), "SELECT FROM_UNIXTIME(%d, '%Y %D %M')", timestamp);
mysql_query(string);
}
Re: mysql timestamps -
Kar - 03.09.2011
timestamp(timestamp) has no return value
timestamp = mysql_fetch_int(); ..?
'%d-%02d-%02d %02d:%02d:%02d' is a string.
Re: mysql timestamps -
JaTochNietDan - 03.09.2011
Why don't you just use gettime without any arguments? It returns a timestamp.
https://sampwiki.blast.hk/wiki/Gettime
Re: mysql timestamps - Unknown123 - 03.09.2011
Quote:
Originally Posted by JaTochNietDan
|
it return the current timestamp rite?
i want to make an temp ban script so i can create the timestamp for 2 days/months/years in future
so i can use "stock timestamp" to tell "You will be unbanned at this time: %d-%02d-%02d %02d:%02d:%02d"
Re: mysql timestamps -
Improvement™ - 03.09.2011
Quote:
Originally Posted by Unknown123
it return the current timestamp rite?
i want to make an temp ban script so i can create the timestamp for 2 days/months/years in future
so i can use "stock timestamp" to tell "You will be unbanned at this time: %d-%02d-%02d %02d:%02d:%02d"
|
Yep, it returns the timestamp of
0 GMT since the date of 01 January 1970, and time of 00:00 AM. I also made my temporally ban/mute system with timestamps. But guess what the best part is, it works perfectly. (In my opinion)
Re: mysql timestamps - Unknown123 - 03.09.2011
Quote:
Originally Posted by Improvement™
Yep, it returns the timestamp of 0 GMT since the date of 01 January 1970, and time of 00:00 AM. I also made my temporally ban/mute system with timestamps. But guess what the best part is, it works perfectly. (In my opinion)
|
ok, so you made a temp ban/mute system, what does that help me? i dont see any of your posts that you have realeased it so idk who you did it
Re: mysql timestamps -
Improvement™ - 03.09.2011
Quote:
Originally Posted by Unknown123
ok, so you made a temp ban/mute system, what does that help me? i dont see any of your posts that you have realeased it so idk who you did it
|
I was just answering and explaining your question, and also mentioning that I use the timestamp methode for temporally systems. And if you expect me to post any kind of systems on this topic, then the answer is obviously No.
Kind Regards,
Improvement™
Re: mysql timestamps - Unknown123 - 03.09.2011
ok... anyone else know how to make a function to create timestamps by typing the date, month, year?
and a function to format the timestamp to date: day, month, year - hour, minute, second
Re: mysql timestamps -
Improvement™ - 03.09.2011
It doesn't work 100% most probably because, re-read the Quote once more :P.
Quote:
Originally Posted by Improvement™
Yep, it returns the timestamp since the date of 01 January 1970, and time of 00:00 AM (0 GMT). I also made my temporally ban/mute system with timestamps. But guess what the best part is, it works perfectly. (In my opinion)
|
FIRST EDIT:
pawn Код:
new timestamp = gettime(); //example timestamp of 0 GMT
new timestamp = gettime()+3600; //example timestamp of 1 GMT (+3600 = +1 Hour)
new timestamp = gettime()+7200; //example timestamp of 2 GMT (+7200 = +2 Hours)
new timestamp = gettime()+10800; //example timestamp of 3 GMT (+10800 = +3 Hours)
//Etc. Untill you get your local timestamp.
Re: mysql timestamps - Unknown123 - 03.09.2011
Quote:
Originally Posted by Improvement™
It doesn't work 100% most probably because, re-read the Quote once more :P.
FIRST EDIT:
pawn Код:
new timestamp = gettime(); //example timestamp of 0 GMT new timestamp = gettime()+3600; //example timestamp of 1 GMT (+3600 = +1 Hour) new timestamp = gettime()+7200; //example timestamp of 2 GMT (+7200 = +2 Hours) new timestamp = gettime()+10800; //example timestamp of 3 GMT (+10800 = +3 Hours) //Etc. Untill you get your local timestamp.
|
Thnaks is there a way with pawno to find somones GMT time?
like:
Get_GMT_Time(playerid);