Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert sys date-time 2

Status
Not open for further replies.

slok

Programmer
Jul 2, 1999
108
SG
How can I insert the system date time into a table?
 
but using 'sysdate doesn't give me the time as well.

eg. here's how I use it

insert into tablename (sysdate);

how can I have something like this?
eg.
'23-02-2002, 11:34:11'


thanks
 
slok,

Actually, it does give you the time information as well. Dates and times in Oracle are always stored with the time information.

How date/time columns are displayed depends upon the variable NLS_DATE_FORMAT. I haven't done this in a while so you'll have to do a bit of digging in the Oracle documentation to find out how to set it and what to set it to. Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
create table time_exp ( date_time date );

insert into time_exp ( date_time ) values ( sysdate );

select to_char(date_time,'DD-MM-YYYY, HH24:MI:SS')
from time_exp;


Dates are always stored with a time element but just selecting the date will only display the date, if you want the time then you have to provide a 'format template' when selecting the date.

Hope this helps
JJ

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top