## simple date problem, simple solution?

### simple date problem, simple solution?

I can get the current time and date with gettime and strftime, this is
not a problem. What I also need is a way to calculate what the date is a
week from now. For instance, if my program happens to run on 03/30/2000.
I need to generate somehow a string that says 04/06/2000. Rolling my own
for this of course is possible, but this is such a common problem I
think their must be a common, tried and true solution. With the
structure vars (I'm talking about a C or C++ solution) I can increment
the day, but is there an easy way for me to program the logic that the
month or year may need to roll up as well?

Thanks in advance for all inqueries.

Iksrazal.

--
"That vulnerability is completely theoretical." -- Microsoft

### simple date problem, simple solution?

Quote:> I can get the current time and date with gettime and strftime, this is
> not a problem. What I also need is a way to calculate what the date is a
> week from now. For instance, if my program happens to run on 03/30/2000.
> I need to generate somehow a string that says 04/06/2000. Rolling my own
> for this of course is possible, but this is such a common problem I
> think their must be a common, tried and true solution. With the
> structure vars (I'm talking about a C or C++ solution) I can increment
> the day, but is there an easy way for me to program the logic that the
> month or year may need to roll up as well?

Get a `now' time_t, add 7*86400, and convert as appropriate. I think
the functions you'd want, in order, are probably:

time()
(add the week here)
localtime()
strftime()

The main problem with the above approach is, what if the day isn't
exactly 86400 seconds long? [1] That is, what about leap seconds? I
suspect you won't consider this a serious problem, especially if
you're only after the date, but I thought I'd mention it. :-)

-Rus.

[1] Not that any day truly is, but you know what I mean :-)

I have been trying to solve the following problem with mod_rewrite but with
no success.

/HelloWorld?FirstVar=xx

to

/cgi-bin/NewHelloWorld?NewVar=11&FirstVar=xx

The first URL should be "re-written" to the new one. Also the "FirstVar=xx"
is an optional param (where xx can be any number or text)

I have tried a lot of combinations and looked at your Re-Write Guide but
couldn't come up with a solution.

I thought I could it with RedirectMatch but couldn't and tried doing it with
mod_rewrite. Any solutions ..

Thanks
--Sri

Sent via Deja.com http://www.deja.com/