Phenomena Posted September 23, 2013 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 94 Reputation: 4 Joined: 10/31/12 Last Seen: February 13, 2022 Share Posted September 23, 2013 Is this possible gettimestr("%Y-%m-%d %H:%M:%S",21) -> gettimetick and back? Quote Link to comment Share on other sites More sharing options...
Brian Posted September 23, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted September 23, 2013 You could use query_sql and MySQL's functions: FROM_UNIXTIME() UNIX_TIMESTAMP() Quote Link to comment Share on other sites More sharing options...
Phenomena Posted September 23, 2013 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 94 Reputation: 4 Joined: 10/31/12 Last Seen: February 13, 2022 Author Share Posted September 23, 2013 So, as i correctly check mysql manual: set .account_id, getcharid(3); query_sql "SELECT `userid` FROM `login` WHERE `account_id` = '"+ escape_sql( .account_id )+"'", .account_name$ ; set .start_time, gettimetick(2); set .end_time, .start_time + 600; // 10 minutes mes "[ Meneger ]"; mes "Account ID: " + .account_id; mes "Login: " + .account_name$; mes "Time start (UNIX): " + .start_time; mes "Time end (UNIX): " + .end_time; mes gettimestr("%Y-%m-%d %H:%M:%S",21); query_sql "INSERT INTO `account_type` ( `account_id`, `account_name`, `start_date`, `end_date`, `status` ) VALUES ( " + .account_id + ", '"+ escape_sql( .account_name$ )+"', UNIX_TIMESTAMP(" + .start_time + "), UNIX_TIMESTAMP(" + .end_time + "), 1 ) "; Is this correct? Quote Link to comment Share on other sites More sharing options...
Brian Posted September 23, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted September 23, 2013 What format are your `start_date` and `end_date` columns? If they are YYYY-MM-DD HH:MM:SS then you should us FROM_UNIXTIME() to convert from UNIX timestamp to Date-Time format. 1 Quote Link to comment Share on other sites More sharing options...
Phenomena Posted September 23, 2013 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 94 Reputation: 4 Joined: 10/31/12 Last Seen: February 13, 2022 Author Share Posted September 23, 2013 (edited) CREATE TABLE IF NOT EXISTS `account_type` ( `account_id` int(11) unsigned NOT NULL default '0', `account_name` varchar(255) NOT NULL default 'NULL', `start_date` datetime NOT NULL default '0000-00-00 00:00:00', `end_date` datetime NOT NULL default '0000-00-00 00:00:00', `status` varchar(255) NOT NULL DEFAULT 'NULL', PRIMARY KEY (`account_id`)) ENGINE=MyISAM;start_date and end_date in %Y-%m-%d %H:%M:%S format,so its must be FROM_UNIXTIME(" + .start_time + ")? will try now... its work, will make some tests, thank you! Edited September 23, 2013 by Phenomena Quote Link to comment Share on other sites More sharing options...
Question
Phenomena
Is this possible gettimestr("%Y-%m-%d %H:%M:%S",21) -> gettimetick and back?
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.