473,842 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert timestamp to yyyy-mm-dd format

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
Feb 8 '08 #1
3 52634
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
Feb 8 '08 #2
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_na me, '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
Feb 8 '08 #3
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(D AY(fec)),9,2) || '-' ||
SUBSTR('EneFebM arAbrMayJunJulA goSepOctNovDic' ,MONTH(fec)*3-2,3) || '-' ||
SUBSTR(DIGITS(Y EAR(fec)),7,4);
END

Diego


"yogi" <yo*****@gmail. comwrote in message
news:d5******** *************** ***********@i7g 2000prf.googleg roups.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

Feb 9 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8677
by: Manzoorul Hassan | last post by:
I need to convert a date / time to NTP Timestamp, in HEX no less, and was wondering if there might be a module for it. Any ideas? I have been searching for NTP Timestamp under Perl but have not found much - yet. - manzoor
4
5351
by: Prakash | last post by:
Hi Can anyone tell me how to derive "yyyy" from a timestamp column in db2? Something like to_char(sysdate, 'yyyy') ... in oracle. I have to oracle-like to_char function but its very slow. If the column is DATE then I can use char(date, USA) and then substr of 'yyyy', but I am not sure how can I do this with timestamp. Please help
8
18931
by: Chris | last post by:
Sorry, This should be simple, but brain is hurting... How do I convert a Current Time to a Decimal 6,0 (HMS)? There must be a cleaner way then this: Insert into Table Values Dec( Substr(Char(CURRENT TIMESTAMP),12,2) ||
4
4116
by: Dean Slindee | last post by:
I have a timestamp field that I would like to display in a textbox. The timestamp is an 8 byte array. Can this be converted to a string in one statement or does it require cycling thru one byte at a time. Thanks, Dean Slindee
10
15479
by: David Garamond | last post by:
The Postgres manual says: The AT TIME ZONE construct allows conversions of time stamps to different time zones. I'd guess most people would think what's meant here is something like "unit conversion", and that the timestamp value stays the same (much like 2 feet becomes 24 inches when it's being "converted"). But: # SELECT NOW() = NOW() AT TIME ZONE 'UTC';
10
39199
by: satishrajana | last post by:
Hi, My SQL returns a NULL in a datefield if there is no date in that field. If there is a NULL in this column, I want to replace it with spaces in my SELECT statement when I am selecting these records. Can any of you experts out there help me with a sample SQL.
1
1875
by: sebasC | last post by:
the code below is used on a site to show time in multiple time zones on the website what i need is to convert the php code below to asp so that it will work. because the clock shows on the site but does not update. I included the javascript to help to illustrate how the code interacts to create the time displayed <? $timers = Array("New York"=>-5, "London"=>0, "Tokyo"=>9, "Sao Paulo"=>-3, ...
3
12383
by: Jonathan | last post by:
I have taken up C++ programming again and need to write a socket client, so far I am able to create the connection to the socket. As I need a unix timestamp in char to put on a socket in a HTTP 1.1 GET request I am looking for a way to convert the unix timestamp to a char? I am using the following code to generate my unix timestamp: ...
0
1281
by: sloan | last post by:
Select Convert( int , MyTimeStampColumn ) as MyTimeStampINT from dbo.SomeTable Then use it as an int in your c# Use an alias so you keep it straight. (MyTimeStampINT is my alias)
4
3725
by: Tim Kelley | last post by:
Is it possible to store a sql2000 timestamp field to a variable in C#. I am creating a dataset from a stored procedure and one of the fields is a timestamp field. I have created a variable of type binary, but I am not sure how to convert to data in the dataset. Thanks.
0
9715
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10610
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10670
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9451
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectóplanning, coding, testing, and deploymentówithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7854
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Duprť who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4499
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4087
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3141
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.