Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2014
    Posts
    294

    Unanswered: how to remove 00:00:00 from the date output

    Hi,

    i have written a function which will be do some calculations & displays the date value as an output.
    I can find my output as

    1
    ---------------------
    2014-06-27 00:00:00.0

    I want to remove the 00:00:00 from the out put , as I want to display only

    1
    ---------------------
    2014-06-27

    even i tried with
    select cast(date_hl as varchar(10)) from sysibm.sysdummy1
    in my function,

    but still i can find the zeros along with my output.

    the above cast function is working when i am running on command prompt.If the same thing which I mentioned in function, it is not working.

    kindly let me know how to go with this.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    because of timestamp format
    try date(timestamp_col)
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Jul 2014
    Posts
    294
    Thanks for the response.
    I tried as u mentioned with date(column_name).But, still i can see those 00:00:00 after the date.

  4. #4
    Join Date
    Sep 2013
    Location
    India
    Posts
    246
    Quote Originally Posted by HABBIE View Post
    Thanks for the response.
    I tried as u mentioned with date(column_name).But, still i can see those 00:00:00 after the date.
    Habbie,

    Certainly there are some lines in your function causing thease 00:00:00 to appear. Please post the relevent lines of the function.

    Meanwhile you may try :

    SELECT VARCHAR_FORMAT(CURRENT timestamp, 'YYYY-MM-DD')FROM SYSIBM.SYSDUMMY1
    ssumit

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •