Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hey, ok, here's a should-be si

Status
Not open for further replies.

rtnMichael

Programmer
Aug 5, 2002
152
US
hey,
ok, here's a should-be simple question. I am taking in a value from a drop down. The question asks what time of the day they would like to run a cron job. I need the value to be between 0-23, and the options would look like hours of the day, e.g. 1 a.m., 2 a.m....

so I was wondering, I have to send it over to the next page, but I can only send over the value, not the "option" part, at least that's what I understand. I need to print out the time on the next page, and I would like for it to say "time run: 11 p.m." but the value will be 22. How can I go about doing that? I was thinking about a switch case statement, but I have no idea of the syntax for it in VBScript or Javascript.

Thanks
M
 
Hi rtnMichael,

I don't know which language you are programming so the example below is just the way you could do it, NOT THE RIGHT SYNTAX !!!

But I assume you know the IF statement and something about strings in the language you use, so try something like this:
(you should takes values from "1 - 24" for this example)
_________________________________
If
value > 12
then
value = value - 12;
substring = 'p.m.'
else
substring = 'a.m.'
end if

DateString = value + substring
_________________________________

Hope this helps,
Erik <-- My sport: Boomerang throwing !!
!! Many Happy Returns !! -->
 
works...a few changes, but the skeleton did the job! :)

Thanks
M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top