3
I have the following code:
View:
{
xtype: 'timefield',
name: 'attendance_time',
fieldLabel: 'Hora',
inputWidth: 100,
format: 'H:i',
submitFormat: 'H:i',
altFormats: 'H:i',
}
Model:
{
name: 'attendance_time',
type: 'date',
dateFormat: 'H:i'
}
Field on the bench:
ALTER TABLE person_attendances ADD COLUMN attendance_time TIME(0) DEFAULT CURRENT_TIME;
Error while trying to include:
SQLSTATE[22007]: Invalid datetime format: 7 ERROR: invalid input syntax for type time: "2019-10-03T01:15:00", query was: INSERT INTO "person_attendances" ("person_id", "origin", "name", "Category", "Description", "tag", "attendance_date", "attendance_time", "title", "id") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
I understood, however I wanted to format it only to save H:i, because the field in DB is time. I wonder if?
– Luis Felipe
@Luisfelipe, you just need to
H:i
(guy 23:59)? if yes, why use timestamp? you can use string direct and wouldn’t even need to convert.. no?– rLinhares
Ah my idea of using the team is because I wanted to get the current_time whenever I add a new record, for example.
– Luis Felipe
I will put in the answer an alternative to take in php these info (better than in comment =p)..
– rLinhares
I added the "s" of seconds in the model and there was "dateFormat: 'H:i:s' " and it worked, no more error appears when inserting. Exactly because I didn’t understand kk
– Luis Felipe
good, solving is what matters :P I will try to search here and if I find something I pass
– rLinhares