heroku - MySQL datatime versus timestamp with regards to how time is recorded/displayed -


i noticed in test run

    mysql> select * enumdecoder; +----+---------------------+---------------------+------+--------------------+-------+-------+------+----------+  | id | createstamp         | modstamp            | flag | classname          | value | label | abv  | sequence | +----+---------------------+---------------------+------+--------------------+-------+-------+------+----------+ |  1 | 2015-04-22 03:11:17 | 2015-04-22 15:11:18 |    0 | testelementfactory | 1   | null  | 1  |       10 | |  2 | 2015-04-22 03:11:17 | 2015-04-22 15:11:18 |    0 | testelementfactory | 2   | null  | 2  |       20 | |  3 | 2015-04-22 03:11:17 | 2015-04-22 15:11:18 |    0 | testelementfactory | 3 | null  | thre |       30 | |  4 | 2015-04-22 03:11:18 | 2015-04-22 15:11:18 |    0 | null               | null  | null  | null |        0 | +----+---------------------+---------------------+------+--------------------+-------+-------+------+----------+ 

the definition of table follows:

create table enumdecoder (     id bigint(20) not null auto_increment primary key,     createstamp datetime not null default '2000-01-01 00:00:00',     modstamp timestamp,     flag bigint(20) not null default 0,     classname char(254),     value char(50),     label char(50),     abv char(5),     sequence smallint(3) signed not null default 0 ); 

in case wondering why default it's because i'm jumping through hoops heroku play nice play framework (something claims out of box) heroku won't allow either multiple columns have auto updating timestamp nor allow triggers. i've re-written core db library accommodate them , default make slips through cracks stick out sore thumb.

ah - answered while writing question!

had following defined time source:

val sqlfmt = datetimeformat.forpattern("yyyy-mm-dd hh:mm:ss") 

what needed of course...

val sqlfmt = datetimeformat.forpattern("yyyy-mm-dd hh:mm:ss") def = new datetime() def sqlnow = sqlfmt.print(now) 

good think noticed in afternoon!

now expected:

mysql> select * enumdecoder; +----+---------------------+---------------------+------+--------------------+-------+-------+------+----------+ | id | createstamp         | modstamp            | flag | classname          | value | label | abv  | sequence | +----+---------------------+---------------------+------+--------------------+-------+-------+------+----------+ |  1 | 2015-04-22 15:18:40 | 2015-04-22 15:18:41 |    0 | testelementfactory | 1   | null  | 1  |       10 | |  2 | 2015-04-22 15:18:40 | 2015-04-22 15:18:41 |    0 | testelementfactory | 2   | null  | 2  |       20 | |  3 | 2015-04-22 15:18:40 | 2015-04-22 15:18:41 |    0 | testelementfactory | 3 | null  | thre |       30 | |  4 | 2015-04-22 15:18:41 | 2015-04-22 15:18:41 |    0 | null               | null  | null  | null |        0 | +----+---------------------+---------------------+------+--------------------+-------+-------+------+----------+ 4 rows in set (0.00 sec) 

figured i'd post anyways in case needed laugh @ today :)


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -