How do I do this correctly?
#1

Quote:

Note that in MySQL, you can use the FROM_UNIXTIME() function to retrieve a date:

Code:
mysql> SELECT FROM_UNIXTIME(1196440219);
-> '2007-11-30 10:30:19'
mysql> SELECT FROM_UNIXTIME(1196440219) + 0;
-> 20071130103019.000000
mysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),
-> '%Y %D %M %h:%i:%s %x');
-> '2007 30th November 10:30:59 2007'

My attempt:
pawn Код:
stock GetDate(timestamp)
{
    new query[300];
    format(query, sizeof(query), "SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(%d),'%D %M %Y %h:%i')", timestamp);
    mysql_query(query);
    mysql_store_result();
    if(mysql_num_rows() > 0)
    {
        format(query, sizeof(query), "%s", timestamp);
    }
    mysql_free_result();
    return 1;
}
Now this can't be right..?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)