sql - Oracle/PHP syntax to grab and later store a timestamp value in a date field -
there composite primary key stored in db consists of date field , foreign key id. create duplicates date field (although displays day, month, year appears have timestamp information stored well)
my question how extract timestamp information (i think using to_char field) , more importantly, how can later insert record , store date , timestamp.
right can store date not sure syntax need use add time date field insert can consistent values pull table select.
the oracle date data type includes time portion.
to date date column using to_char:
to_char(date_column, 'dd-mm-yyyy')
...not sure syntax need use add time date field insert can consistent values pull table select.
to specify time portion existing date, use combination of to_date , to_char:
to_date(to_char(date_column, 'dd-mm-yyyy') || ' 23:59:00', 'dd-mon-yyyy hh24:mi:ss')
...changing 23:59:00 whatever time want. double pipe (||) oracle uses string concatenation (it's ansi standard).
Comments
Post a Comment