YePix Posted August 4, 2018 Share Posted August 4, 2018 Hi Guys. How do I get only the time from the DB for account creation? customers_info_date_account_created = 0000-00-00 00:00:00 I need only the time. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted August 4, 2018 Share Posted August 4, 2018 Try this, MySQL EXTRACT() Function https://www.w3schools.com/sql/func_mysql_extract.asp Link to comment Share on other sites More sharing options...
♥Tsimi Posted August 4, 2018 Share Posted August 4, 2018 Not sure where you want to display this but you could either create a new function inside the general.php or manipulate the tep_datetime_short function. A new function could look like this function tep_time_long($raw_time) { if ( ($raw_time == '0000-00-00 00:00:00') || ($raw_time == '') ) return false; $hour = (int)substr($raw_time, 11, 2); $minute = (int)substr($raw_time, 14, 2); $second = (int)substr($raw_time, 17, 2); return strftime(TIME_LONG, mktime($hour, $minute, $second)); } Add a new definition inside the language file (english.php or in your case german.php) define('TIME_LONG', '%H:%M:%S'); Then use tep_time_long(....) to output the time. Or if you don't want the seconds just add the following into your language file define('TIME_SHORT', '%H:%M'); Or you could manipulate the existing tep_datetime_short function by replacing DATE_TIME_FORMAT with the new added TIME_SHORT or TIME_LONG and then use tep_datetime_short (...) to output the time. Of course you will need to query the info from the database (customers_info_date_account_created) This is from the admin/customers.php file $info_query = tep_db_query("select customers_info_date_account_created as date_account_created, customers_info_date_account_last_modified as date_account_last_modified, customers_info_date_of_last_logon as date_last_logon, customers_info_number_of_logons as number_of_logons from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customers['customers_id'] . "'"); Maybe there is even an easier way, a PHP way to do it but I am not aware of one at the moment. Link to comment Share on other sites More sharing options...
PiLLaO Posted August 4, 2018 Share Posted August 4, 2018 Try this: https://www.w3schools.com/sql/func_mysql_time.asp Find in Google Link to comment Share on other sites More sharing options...
YePix Posted August 5, 2018 Author Share Posted August 5, 2018 @Tsimi Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.