Iniciar uma conversa

Separating the date and time display in a field in a query DataTime

Create a table in MySQL database with the code below
CREATE TABLE `banking_bill` (
`id` int(11) NOT NULL auto_increment,
`bill_value` varchar(10) NOT NULL,
`expiration_date` datetime NOT NULL,
`number_plots` varchar(10) NOT NULL,
`wallet` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

INSERT INTO `banking_bill` (`id`, `bill_value`, `expiration_date`, `number_plots`, `wallet`) VALUES (1, '150.25', '2011-08-30 12:10:15', '1', '15');
Create a query table with the name of Banking_bill grid_datetime
Create the field day, month, year and time function in the new field
Click and add the new field name and label data in the fields to be created
Create a php method named separate_datetime()
Insert php code into the method separate_datetime()
sc_lookup(dataset,"SELECT expiration_date, date_format(expiration_date, '%m'), date_format(expiration_date, '%d'), date_format(expiration_date, '%Y'), date_format(expiration_date, '%r') FROM banking_bill");
if(!empty({dataset})){
$data_datatime = {dataset}[0][0]; // receives the value of the first column of the query
 
$months = array("01" =>"January", // receives the value of the second column of the query
"02" => "February",
"03" => "March",
"04" => "April",
"05" => "May",
"06" => "June",
"07" => "July",
"08" => "August",
"09" => "September",
"10" => "October",
"11" => "November",
"12" => "December");
$m = {dataset}[0][1];;
$day_expiration = {dataset}[0][2]; // receives the value of the third column of the query
$year_expiration = {dataset}[0][3]; // receives the value of the fourth column of the query
$hour_expiration = {dataset}[0][4];// receives the value of the fifth column of the query
 
}
{months} = $months[$m]; // receives the value of the month and upgrade the registered number of months to name the months in English
{days}= $day_expiration; // receives the value of the registered day
{years}= $year_expiration; // receives the value of the registered year
{hours}=$hour_expiration; // receives the value of the registered hour
Call the method separate_datatime () in the event onRecord
Run the application
Escolher arquivos ou arraste e solte arquivos
Esse artigo foi útil?
Sim
Não
  1. Amanda Santos (Migrated deleted Agent)

  2. Publicado
  3. Atualizado

Comentários