If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Convert date format to yyyymmdd

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-28-10, 13:42
logle0917 logle0917 is offline
Registered User
 
Join Date: Jun 2010
Posts: 2
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 17:39.
Reply With Quote
  #2 (permalink)  
Old 07-07-10, 13:08
artemka artemka is offline
Registered User
 
Join Date: May 2004
Location: New York
Posts: 248
just use the datetime function
Reply With Quote
  #3 (permalink)  
Old 07-27-10, 02:26
ervinelan ervinelan is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 07-30-10, 04:27
stevemorse stevemorse is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 08-03-10, 08:25
dianesmith0510 dianesmith0510 is offline
Registered User
 
Join Date: Aug 2010
Posts: 1
Wow thanks for the information.
Reply With Quote
  #6 (permalink)  
Old 08-03-10, 20:49
Website Builder Website Builder is offline
Registered User
 
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.
Reply With Quote
  #7 (permalink)  
Old 08-09-10, 14:30
sivay2k1 sivay2k1 is offline
Registered User
 
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
Reply With Quote
  #8 (permalink)  
Old 08-11-10, 13:16
patti217 patti217 is offline
Registered User
 
Join Date: Aug 2010
Posts: 1
This is a big help
Reply With Quote
  #9 (permalink)  
Old 08-16-10, 18:39
canadahottub456 canadahottub456 is offline
Registered User
 
Join Date: Aug 2010
Posts: 1
thanks I found a snippet for my date stamp yet I need a time stamp too
Reply With Quote
  #10 (permalink)  
Old 09-05-10, 11:24
angeluisa angeluisa is offline
Registered User
 
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!
Reply With Quote
  #11 (permalink)  
Old 09-21-10, 08:52
InformixWilli InformixWilli is offline
Registered User
 
Join Date: Sep 2010
Location: Germany, Brunswick
Posts: 52
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,"",""
Reply With Quote
  #12 (permalink)  
Old 10-08-10, 20:58
barrettpaula barrettpaula is offline
Registered User
 
Join Date: Oct 2010
Posts: 1
Hi all! I am also a new member here..and interested to know about thesse things..thanks!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On