Home » SQL & PL/SQL » SQL & PL/SQL » Oracle timestamp (Oracle 9i)
Oracle timestamp [message #317357] Wed, 30 April 2008 17:00 Go to next message
ShadowGear
Messages: 2
Registered: April 2008
Junior Member
I'm new to PL/SQL and i'm having trouble displaying only the time in the timestamp in the following code:

DECLARE
time_zone VARCHAR(3) := 'EST';
other_time TIMESTAMP(0) := NEW_TIME(SYSDATE, time_zone, 'CST');

BEGIN
DBMS_OUTPUT.PUT_LINE('The current time in City 1 is ' || other_time );
other_time := NEW_TIME(SYSDATE, time_zone, 'GMT');
DBMS_OUTPUT.PUT_LINE('The current time in City 2 is ' || other_time );
END;

Any help is appreciated
Re: Oracle timestamp [message #317360 is a reply to message #317357] Wed, 30 April 2008 17:34 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
use TO_CHAR
Re: Oracle timestamp [message #317362 is a reply to message #317360] Wed, 30 April 2008 17:39 Go to previous messageGo to next message
ShadowGear
Messages: 2
Registered: April 2008
Junior Member
I've tried to_char(other_time, 'h:mm a');

that doesn't work, am i doing it wrong?
Re: Oracle timestamp [message #317363 is a reply to message #317357] Wed, 30 April 2008 17:52 Go to previous message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
>I've tried to_char(other_time, 'h:mm a');
>that doesn't work,

Sorry to hear that

>am i doing it wrong?
Yes.

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#i165520
Previous Topic: not null column count (merged 2)
Next Topic: deleting 10 million records form a table
Goto Forum:
  


Current Time: Sun Dec 11 08:07:48 CST 2016

Total time taken to generate the page: 0.04684 seconds