Wettig, Marco wrote:
> Hi,
> 
> I would like to make a select on a timestamp field in a table 
> and format it
> in a certain way.
> The table is:
> create table my_table 
> (col_timestamp timestamp)
> 
> If you do a select (e.g. select col_timestamp from my_table) you get
> something like '2003-03-18 12:40:57.683825', depending on your system
> settings.
> 
> However, I need something like '18.03.2003 12:40'.
> 
> What I did was:
> select col_timestamp, LFILL(chr(day(col_timestamp)),'0',2) & '.' &
> LFILL(chr(month(col_timestamp)),'0',2) & '.' & 
> chr(year(col_timestamp)) &
> LFILL(chr(hour(col_timestamp)),'0',2) & ':' &
> LFILL(chr(minute(col_timestamp)),'0',2)  as my_time from my_table
> 
> This works but it seems kind of clumsy to me.
> Is there a better way to do this??

What about (untested)
select  CHAR (DATE(col_timestamp), EUR) || ' ' || substr (CHAR (TIME(col_timestamp) 
ISO), 1, 5) 

Elke
SAP Labs Berlin
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to