?
Solved

add 9 hours to actual value

Posted on 2005-04-02
12
Medium Priority
?
245 Views
Last Modified: 2010-04-07
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.
0
Comment
Question by:lynnton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
12 Comments
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 13687211
You can add 9 hours with the DateAdd function:

DateAdd("h", 9, datetimeVar)
0
 
LVL 1

Author Comment

by:lynnton
ID: 13687220
leew,

Will it work on

23:30:00 ?

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

Thanks.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 13687232
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
 
LVL 1

Author Comment

by:lynnton
ID: 13687240
leew,

How are you?
0
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 13687245
Ummm... ok?  Seems an odd question given the topic... we know each other?
0
 
LVL 1

Author Comment

by:lynnton
ID: 13687289
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
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 13687323
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
 
LVL 1

Author Comment

by:lynnton
ID: 13687329
leew,

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

How can we change it to 00:00:00

Thanks.
0
 
LVL 96

Accepted Solution

by:
Lee W, MVP earned 2000 total points
ID: 13687371
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
 
LVL 1

Author Comment

by:lynnton
ID: 13687459
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
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 13687484
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question