?
Solved

TRUNCATE DATE

Posted on 2006-04-27
4
Medium Priority
?
1,659 Views
Last Modified: 2008-02-01
i have this date
select DM_CREATE_DATETIME from  dim_branch  fetch first 5 rows only

DM_CREATE_DATETIME        
--------------------------
2006-04-27-14.30.55.667009
2005-10-11-15.40.52.849001
2005-10-11-15.40.52.849002

how can i truncate it too
DM_CREATE_DATETIME        
--------------------------
2006-04-27
2005-10-11
2005-10-11

thanks,
Bobby
0
Comment
Question by:bobby2929
3 Comments
 
LVL 2

Expert Comment

by:srielau
ID: 16555926
select DATE(DM_CREATE_DATETIME) from  dim_branch  fetch first 5 rows only
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 16556109
Hi Bobby,

  select substr (cast (DM_CREATE_DATETIME as char(20)), 1, 10) from ...


Good Luck!
Kent
0
 
LVL 7

Accepted Solution

by:
sachinwadhwa earned 200 total points
ID: 16560076
if your column is timestamp or varchar/char :

date(DM_CREATE_DATETIME)

alternatively your column is varchar/char:

left(DM_CREATE_DATETIME,10)

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question