|  | 
 
  
    | RSS Feed - WebSphere MQ Support | RSS Feed - Message Broker Support |  
 
  
	|    |  |  
  
	| Subtract one day from given Date. | « View previous topic :: View next topic » |  
  	| 
		
		
		  | Author | Message |  
		  | venky | 
			  
				|  Posted: Fri Feb 27, 2004 1:32 pm    Post subject: Subtract one day from given Date. |   |  |  
		  |  Master
 
 
 Joined: 08 Jul 2003Posts: 205
 
 
 | 
			  
				| Hi All, 
 I have to subtract one day from a given date.
 My date is stored in Environment Variable.
 
 And My code is:
 (CAST(Environment.Variables.PO_LINE[I].PCDATA[Env_Cntr  +
 1].pc_start AS DATE) - 1);
 
 My Date is stored in the Environment Variable in the format:
 pc_start     = TIMESTAMP '2004-02-18 00:00:00'
 
 It errors Out.
 
 Pls Help.
 
 Thanks,
 Venky
 --
 |  |  
		  | Back to top |  |  
		  |  |  
		  | kirani | 
			  
				|  Posted: Fri Feb 27, 2004 1:37 pm    Post subject: |   |  |  
		  | Jedi Knight
 
 
 Joined: 05 Sep 2001Posts: 3779
 Location: Torrance, CA, USA
 
 | 
			  
				| Try using INTERVAL data type. Also, if you do a search in this forum for INTERVAL and you can find related post with some sample code.
 _________________
 Kiran
 
 
 IBM Cert. Solution Designer & System Administrator - WBIMB V5
 IBM Cert. Solutions Expert - WMQI
 IBM Cert. Specialist - WMQI, MQSeries
 IBM Cert. Developer - MQSeries
 
 
 |  |  
		  | Back to top |  |  
		  |  |  
		  | Missam | 
			  
				|  Posted: Fri Feb 27, 2004 1:40 pm    Post subject: |   |  |  
		  | Chevalier
 
 
 Joined: 16 Oct 2003Posts: 424
 
 
 | 
			  
				| Why don't you try this 
 CAST(Environment.Variables.PO_LINE[I].PCDATA[Env_Cntr +
 1].pc_start AS DATE) - INTERVAL '1' DAY);
 |  |  
		  | Back to top |  |  
		  |  |  
		  | venky | 
			  
				|  Posted: Fri Feb 27, 2004 2:12 pm    Post subject: |   |  |  
		  |  Master
 
 
 Joined: 08 Jul 2003Posts: 205
 
 
 | 
			  
				| HI Kirani and IamSam, 
 I got it working with the syntax you guys gave.
 Thanks for your help.
 
 Thanks,
 Venky
 --
 |  |  
		  | Back to top |  |  
		  |  |  
		  | Missam | 
			  
				|  Posted: Fri Feb 27, 2004 3:03 pm    Post subject: |   |  |  
		  | Chevalier
 
 
 Joined: 16 Oct 2003Posts: 424
 
 
 | 
			  
				| Try this 
 CAST(Environment.Variables.PO_LINE[I].PCDATA[Env_Cntr +
 1].pc_start AS TIMESTAMP) - INTERVAL '1' DAY);
 
 change cast type date to timestamp,it should work
 |  |  
		  | Back to top |  |  
		  |  |  
		  |  |  |  
  
	|    |  | Page 1 of 1 |  
 
 
  
  	| 
		
		  | 
 
 | You cannot post new topics in this forum You cannot reply to topics in this forum
 You cannot edit your posts in this forum
 You cannot delete your posts in this forum
 You cannot vote in polls in this forum
 
 |  |  |  |