Jump to content
  • 0

Is this possible gettimestr("%Y-%m-%d %H:%M:%S",21) -> gettimetick and back


Question

4 answers to this question

Recommended Posts

Posted

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.

  • Upvote 1
Posted

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?

Posted (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 by Phenomena

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...