add 9 hours to actual value

Hi,

We have a drop down list that contains time value every half hour; so there are 48 total items.
items are :
00:00:00
00:30:00
01:00:00
01:30:00
02:00:00
02:30:00
03:00:00
03:30:00
04:00:00
04:30:00
05:00:00
05:30:00
06:00:00
06:30:00
07:00:00
07:30:00
08:00:00
08:30:00
09:00:00
09:30:00
10:00:00
10:30:00
11:00:00
11:30:00
12:00:00
12:30:00
13:00:00
13:30:00
14:00:00
14:30:00
15:00:00
15:30:00
16:00:00
16:30:00
17:00:00
17:30:00
18:00:00
18:30:00
19:00:00
19:30:00
20:00:00
20:30:00
21:00:00
21:30:00
22:00:00
22:30:00
23:00:00
23:30:00

How can we add 9 hours to the selected item in the drop down list and place it on a textbox1.text ?
i.e.
23:30 + 9 hours = 08:30

set auto post back on DDL and textbox1 ?
and on click DDL event place some code..

Please kindly guide me in what code to place in asp.net vb

Thanks.
LVL 1
lynntonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
You can add 9 hours with the DateAdd function:

DateAdd("h", 9, datetimeVar)
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
0
lynntonAuthor Commented:
leew,

Will it work on

23:30:00 ?

I was thinking it would add a date value, which we don't need..

Thanks.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Lee W, MVPTechnology and Business Process AdvisorCommented:
Drop the date value.  Add the 9 hours, then use TimeValue(datetimevar) to just take the time value.  Please test this before you accept as an answer.
0
lynntonAuthor Commented:
leew,

How are you?
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
Ummm... ok?  Seems an odd question given the topic... we know each other?
0
lynntonAuthor Commented:
leew,

You always post on my question, sad, you dont even remember names of people.

it work great, unfortunately, it wa in this format 8:00:00 AM

The system time format is in 00:00:00

Please kindly guide me to change the format

    txtend1.text=format("h:n:s",timevalue(dateadd("h",9,ddlday1.selecteditem.text)))

Thanks.
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
Sorry, in most cases, I don't remember names of people unless they've done something to otherwise annoy me.  I probably participate in 40-60 questions a day, on average...

I'm a little confused... the ddlday1.selecteditem.text was in the format 8:00:00 AM?  Or the result was?  Which format do you want it in?  (Sorry it's late for me so no all neurons are firing appropriately).
0
lynntonAuthor Commented:
leew,

txtend1.text is getting 9:00:00 AM/PM format.

How can we change it to 00:00:00

Thanks.
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
There may well be a function that will do this, but I'm not sure what it is.  I'd write one:

'Remember to define your variables used below; ADateTimeValue, Hr, Mn, Sc

Function TimeTo24(ADateTimeValue)
   Hr = Hour(ADateTimeValue)
   Mn = Minute(ADateTimeValue)
   Sc = Second(ADateTimeValue)
   TimeTo24 = CStr(Hr) & ":" & CStr(Mn) & ":" & CStr(Sc)
End Function

Then modify the following line:

txtend1.text=timeto24(timevalue(dateadd("h",9,ddlday1.selecteditem.text)))
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lynntonAuthor Commented:
leew,

Thanks so much for you time and patience, is it possible if you could glance on this link?

http://experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_21373911.html
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
Sorry, wish I could help you on that one - that's using lots of .net stuff and I'm VERY weak on .NET specific things at the moment.  Best of luck.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.