Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Commands to convert text to date and then add on one day?

SOLVED
Go to solution
Nigel Wright_1
Frequent Advisor

Commands to convert text to date and then add on one day?

The text is in the following format

20-May-2007

Need to add a day to this.

5 REPLIES
Heinz W Genhart
Honored Contributor
Solution

Re: Commands to convert text to date and then add on one day?

Hi Niggel

try the following

write sys$output f$cvtime("20-may-2007+1-","absolute","date")

This should solve your problem


Regards

Geni
John Abbott_2
Esteemed Contributor

Re: Commands to convert text to date and then add on one day?

How's about

$ write sys$output f$cvtime("20-may-2007+01-00","absolute")

Kind Regards
John.
Don't do what Donny Dont does
Robert Gezelter
Honored Contributor

Re: Commands to convert text to date and then add on one day?

Nigel,

Though you do not say, I presume that the actual date is contained in a lexical symbol (e.g., CURRENT_DATE).

In that case you will need to use the DCL symbolic substitution facility together with the lexical function F$CVTIME, to wit:

$ X = "21-MAY-2007"
$ Y = F$CVTIME("''X'+1-00", "ABSOLUTE", "DATE")
$ SHOW SYMBOL Y
Y = "21-MAY-2007"

I also recommend that you review the documentation on F$CVTIME in either (or both) the online HELP text and the DCL Dictionary (in the documentation kit; available via http://www.hp.com/go/openvms ).

- Bob Gezelter, http://www.rlgsc.com
Nigel Wright_1
Frequent Advisor

Re: Commands to convert text to date and then add on one day?

Hi Niggel

try the following

write sys$output f$cvtime("20-may-2007+1-","absolute","date")

This should solve your problem

The above did indeed solve the problem.
Heinz W Genhart
Honored Contributor

Re: Commands to convert text to date and then add on one day?

Hi Nigel

nice to hear, that it solved your problem.
It would also be nice if you would assign points to the people which helps you to solve your problems. In your forum profile we can see, the following:

I have assigned points to 1 of 29 responses to my questions.

Regards

Geni