Home » RDBMS Server » Server Administration » date & time
date & time [message #371320] Tue, 03 October 2000 13:19 Go to next message
Salman Khan
Messages: 51
Registered: September 2000
Member
Hi,

Iam converting date (which is in char) and then inserting into date field but I want to add specific time with it, not the default one (12:00:00).

Any Idea how can I do this

Thanks
Salman Khan
Re: date & time [message #371321 is a reply to message #371320] Tue, 03 October 2000 13:32 Go to previous messageGo to next message
Suresh
Messages: 189
Registered: December 1998
Senior Member
Hi,
Try this

to_date(yourdatepart||' 23:10:10','mm/dd/yyyy hh24:mi:ss')

Suresh
Re: date & time [message #371322 is a reply to message #371321] Tue, 03 October 2000 13:48 Go to previous messageGo to next message
Salman Khan
Messages: 51
Registered: September 2000
Member
Thank you Suresh for your quick reply, the syntax work is okay but I think it will show me the default time (i.e 12:00am), suresh I want specific time like I want to give 18:00:00 to all my date field data, how can put constant value in it.

Thanks again

Salman Khan
Re: date & time [message #371323 is a reply to message #371322] Tue, 03 October 2000 14:12 Go to previous messageGo to next message
Suresh
Messages: 189
Registered: December 1998
Senior Member
Hi salman,
Actually, In my prior post i was talking about date value before insertion.. I have no idea about how to set default time ( we can set default date format)..If you come to know how to set default time let me know about it

Suresh
Re: date & time [message #371324 is a reply to message #371323] Tue, 03 October 2000 14:50 Go to previous messageGo to next message
Salman Khan
Messages: 51
Registered: September 2000
Member
I am trying how to do this but no luck.

If i tried to update the timestamp only (mean hh:mm:ss) how can this perform? any idea

Thanks
Salman Khan
Re: date & time [message #371325 is a reply to message #371324] Tue, 03 October 2000 14:57 Go to previous messageGo to next message
Suresh
Messages: 189
Registered: December 1998
Senior Member
yes, that you can do..

update tbl
set tdate=to_date(to_char(tdate,'mm/dd/yyyy')||' 18:00:00','mm/dd/yyyy hh24:mi:ss')

Suresh
Re: date & time [message #371326 is a reply to message #371320] Wed, 04 October 2000 00:28 Go to previous message
Naseer
Messages: 5
Registered: September 2000
Junior Member
Hello,

If I understand your problem, you want to add
specific time to date column
so u can
add (4/24) to add 4 hours
add (4/(24*60)) to add 4 minutes and so on.
e.g.
to add 4 hours

Select to_char(to_date(to_char(trunc(sysdate)))+4/24,'ddmmyyyy-hh:mi:ss') from dual ;

hope this will help
greetings
naseer.
Previous Topic: Substitution Variable in Select Statement (HELP)
Next Topic: Subquery in Order By Clause
Goto Forum:
  


Current Time: Thu Apr 25 15:00:25 CDT 2024