Problem with Date(days()) functions

Robert J.M. Edis robert.edis@creatcomp.com
Thu, 8 Apr 1999 11:07:41 -0400


G'day Joseph

May I make a suggestion that doesn't require you to change the PHD defaults?

DEFINE DT   NUM*6                 = 000101
DEFINE d_DT DATE CENTURY INCLUDED = (CENTURY(DT,19,20) * 1000000) + DT
DEFINE ND   NUM*6                 = REMOVECENTURY(DATE(DAYS(d_DT)-4))

This would result in:


     DT      D_DT       ND

      101  01/01/00   991228

Is this what you want?

Blue
PowerHouse consultant
Rhode Island, USA

Disclaimer:
The opinions and ideas expressed in this message are my own and have no
relationship to my current employer, Initial Technical Staffing, its client
CCI, or any of CCI's clients.



	-----Original Message-----
	From:	Joseph Northrop [SMTP:jay_northrop@yahoo.com]
	Sent:	Thursday, April 08, 1999 10:54 AM
	To:	powerh-l@lists.swau.edu
	Subject:	RE: Problem with Date(days()) functions

	First of all, let me thank everyone for the responses
	to my date problem.  

	Upon looking at my original program again, I find
	that I made an error in my original post from
	yesterday.
	The date that I am trying to manipulate is being
	stored as a numeric 6.  Our client stores all of 
	their dates as numeric 6. 

	For the purpose of this message, I will hard code a
	num*6 date into my example:

	DEFINE DT NUM*6 = 000101
	DEFINE ND NUM*6 = DATE(DAYS(DT)-4)

	I have tried various fixes for this, and the latest
	one was in the dictionary, I set INPUT CENTURY
	19 FROM 20 and CENTURY EXCLUDED DEFAULT 20.

	This works fine for all dates except for when the 
	subtraction of 4 days from the date results in a
	date in a different century than the input date.  
	(such as 000101) I get a 0 for ND and a data
	conversion error.  When I set the dictionary
	to CENTURY INCLUDED DEFAULT 20 with
	INPUT CENTURY 19 FROM 20, I get correct
	dates with a 4 digit year (8 digit total) from a
	field that is supposed to be a numeric 6!   Yes,
	we can convert it to CHAR and lop off the
	century, but we were hoping not to have to do
	that...we have a lot of programs effected by
	this.  Plus we are concerned about what else
	this may effect that we aren't aware of.

	I'm not sure where to go with this.  Any help
	would be appreciated.
	_________________________________________________________
	Do You Yahoo!?
	Get your free @yahoo.com address at http://mail.yahoo.com

	= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = =
	Subscribe: "subscribe powerh-l" in message body to
majordomo@lists.swau.edu
	Unsubscribe: "unsubscribe powerh-l" in message to
majordomo@lists.swau.edu
	powerh-l@lists.swau.edu is gatewayed one-way to
bit.listserv.powerh-l
	This list is closed, thus to post to the list, you must be a
subscriber.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.