Results 1 to 13 of 13
  1. #1
    Join Date
    Jun 2010
    Posts
    2

    Unanswered: Convert date format to yyyymmdd

    Here is a snippet of my code. On all my date formats i need to pull the date out in this format yyyymmdd how do I do that my date is in mm/dd/yyyy thanks! If I am not posting according to the Rules or incorrectly please let me know I am new here.

    select
    inv.org_code,
    inv_shp.cust_num,
    cust_name,
    " " cust_po_num,
    inv_shp_l_lot.item_num,
    item.desc_1,
    inv_shp_l_lot.lot_code,
    order_type_code,
    min (shipped_date) first_shipped,
    max (shipped_date) last_shipped,
    sum(inv_shp_l.shipped_qty) Qty_shipped,
    inv_shp_l.tot_net_amt/inv_shp_l.shipped_qty saleWAC,"",""
    Last edited by logle0917; 06-29-10 at 18:39.

  2. #2
    Join Date
    May 2004
    Location
    New York
    Posts
    248
    just use the datetime function

  3. #3
    Join Date
    Jul 2010
    Location
    Singapore
    Posts
    1
    Hai everybody, i am a new member to forums, so i am intereseted
    and want to gain knowledge on this topics..........................thanku

  4. #4
    Join Date
    Jul 2010
    Location
    america
    Posts
    1
    Hai, I am a new member just joined the community and want to gain knowledge
    about the above disscuisions from the others members. thank you

  5. #5
    Join Date
    Aug 2010
    Posts
    1
    Wow thanks for the information.

  6. #6
    Join Date
    Aug 2010
    Posts
    1
    I am also new here and I really want to learn more on how to convert date formats and codes. hoppe I can get something from here.

  7. #7
    Join Date
    Feb 2005
    Posts
    13

    Date format modification:

    Quote Originally Posted by logle0917 View Post
    Here is a snippet of my code. On all my date formats i need to pull the date out in this format yyyymmdd how do I do that my date is in mm/dd/yyyy thanks! If I am not posting according to the Rules or incorrectly please let me know I am new here.

    select
    inv.org_code,
    inv_shp.cust_num,
    cust_name,
    " " cust_po_num,
    inv_shp_l_lot.item_num,
    item.desc_1,
    inv_shp_l_lot.lot_code,
    order_type_code,
    min (shipped_date) first_shipped,
    max (shipped_date) last_shipped,
    sum(inv_shp_l.shipped_qty) Qty_shipped,
    inv_shp_l.tot_net_amt/inv_shp_l.shipped_qty saleWAC,"",""
    -----------------------------
    I am currently working with SQL SERVER but this code above looks like Oracle(PL/SQL).
    Try to_date(to_char(@date_var,"YYYYMMDD),"YYYYMMDD")
    The inside function will yield a char string output and the outside function
    will convert it back into a date format , for you to use in further processing.
    -SK

  8. #8
    Join Date
    Aug 2010
    Posts
    1
    This is a big help

  9. #9
    Join Date
    Aug 2010
    Posts
    1
    thanks I found a snippet for my date stamp yet I need a time stamp too

  10. #10
    Join Date
    Aug 2010
    Posts
    1
    this is i am looking for! thanks dude for sharing this information. it really a great help. more power!

  11. #11
    Join Date
    Sep 2010
    Location
    Germany, Brunswick
    Posts
    55
    You can set the environment variable DBDATE to "Y4MD0":
    export DBDATE=Y4MD0

    Or use the function "TO_CHAR":
    to_char(shipped_date, "%Y%m%d")

    Code:
    select
    inv.org_code,
    inv_shp.cust_num,
    cust_name,
    " " cust_po_num,
    inv_shp_l_lot.item_num,
    item.desc_1,
    inv_shp_l_lot.lot_code,
    order_type_code,
    to_char(min (shipped_date), "%Y%m%d") first_shipped,
    to_char(max (shipped_date), "%Y%m%d") last_shipped,
    sum(inv_shp_l.shipped_qty) Qty_shipped,
    inv_shp_l.tot_net_amt/inv_shp_l.shipped_qty saleWAC,"",""

  12. #12
    Join Date
    Oct 2010
    Posts
    1
    Hi all! I am also a new member here..and interested to know about thesse things..thanks!

  13. #13
    Join Date
    Nov 2014
    Posts
    7
    I have encountered a similar problem with Screen Update. I resolved it. I attachment has the solution with screenshots.

    How to Change YYYYMMDD Format.pdf

Posting Permissions

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