just what i needed
A reader, April 22, 2003 - 11:05 am UTC
only store the time component
A reader, October 19, 2004 - 5:46 pm UTC
Hi Tom,
We need to break a day into a few time blocks. So in the table we have columns "Date", "Start_Time", "End_Time". They all defined as date type. How can I store only time component in the time columns? I tried to_date(to_char('11:30','hh24:mi')), but Oracle default is as today's time, so added date information into the columns.
Thanks.
October 19, 2004 - 8:56 pm UTC
a date is a date -- period. 7 bytes -- always has a date (yyyymmdd hh24 mi ss) in it.
perhaps you want to use just
start_time timestamp,
duration interval,
the concept of storing the "day" in one field, a start time in another and an end in yet a third isn't really a good idea.
At MOST you need start_time, end_time both dates. that date column isn't useful.
only store the time component
A reader, October 19, 2004 - 6:04 pm UTC
Hi Tom,
Correction of the question I asked above. The three columns are "Day_of_Period", "Start_Time", "End_Time". It's to record pre-defined recursive events. I want only store time component in the start/end time columns but not the date component. Is make the columns varchar2 the only option?
Thank you!
October 19, 2004 - 8:57 pm UTC
do NOT store them in varchar2's.
they are dates, there should be TWO dates -- start and end, nothing more. this "day of period" thing isn't useful.
more clarifications
SRR, October 20, 2004 - 7:08 am UTC
Tom
Can you tell me how to store dates into fields which are in a format different from the format which is currently supported by a database...
thanks much...
October 20, 2004 - 11:17 am UTC
huh? does not compute. not sure what you mean.
only store the time component
A reader, October 20, 2004 - 12:05 pm UTC
I totally agree that date should be stored in date type field. But what we want is kind like a calendar template for recursive events, like in a 14 day period, every 2nd day from 9am to 10am is for group meeting, every 10th day from 2:30pm to 5:30pm, is for inventory check.... Since all events are recursive, it doesn't make sense to have date part in the fields. Of course programs can always just extract the time part, I just wonder if there is a way just store the time part in a date type field.
Thank you!
October 20, 2004 - 12:12 pm UTC
the date will always be there (just as the time is always there). just "ignore" the date component (like many just ignore the time). use the part you want.