vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| yogi wrote: > Hi, > I am working on a database that has a variable with timestamp > values. I wanted to convert the variable from timestamp to yyyy-mm-dd > format. db2 => VALUES SUBSTR(VARCHAR(CURRENT TIMESTAMP), 1, 10); 1 ---------- 2008-02-07 1 record(s) selected. -- Serge Rielau DB2 Solutions Development IBM Toronto Lab |
| |||
| yogi wrote: > Hi, > I am working on a database that has a variable with timestamp > values. I wanted to convert the variable from timestamp to yyyy-mm-dd > format. select varchar_format (your_column_name, 'YYYY-MM-DD HH24:MI:SS') from your_table and for an export statement use sth like EXPORT TO my_file OF DEL MODIFIED BY COLDEL; TIMESTAMPFORMAT=\"dd.mm.yyyy hh:mm\" select * from foo -- Toralf Förster pgp key 0x7DB69DA3 |
| ||||
| Some time ago I had to write a function to create a special format for dates in spanish like dd-mmm-yyyy I'm sure you can adapt this to get the function you need CREATE FUNCTION FFF.DATE3( fec DATE ) RETURNS varchar(11) ------------------------------------------------------------------------ -- SQL UDF (Scalar) ------------------------------------------------------------------------ F1: BEGIN ATOMIC RETURN SUBSTR(DIGITS(DAY(fec)),9,2) || '-' || SUBSTR('EneFebMarAbrMayJunJulAgoSepOctNovDic',MONT H(fec)*3-2,3) || '-' || SUBSTR(DIGITS(YEAR(fec)),7,4); END Diego "yogi" <yogibad@gmail.com> wrote in message news:d512b805-60a2-4ea7-94df-20da3468e957@i7g2000prf.googlegroups.com... > Hi, > I am working on a database that has a variable with timestamp > values. I wanted to convert the variable from timestamp to yyyy-mm-dd > format. > > Thanks in advance > > Yogi |