How To Get Total Minutes In Hour
Oct 8, 2008How to get the total minutes in an hour?
Example:
1 Hour and 20 Minutes.
I need to get the result at 80 Minutes.
How to get the total minutes in an hour?
Example:
1 Hour and 20 Minutes.
I need to get the result at 80 Minutes.
Is it possible to configure the System.Timer to run say 30 minutes after every hour? I have searched google to figure this out but all it shows is how to set it where it goes off once an hour, if I launched the app at 2:45 then it would go off again at 3:45. I can forsee issues down the line with this approach where if it went off at a specified time it would not have that issue.
Normally i would use Scheduled Task for this however it doesn't give you the option for hourly just daily, perhaps i'm wrong about this.
The following code takes a timeframe in minutes since midnight and creates an array with minutes pr hour. But, it's slow. Any better suggestions out there? (no, changing language is not an option :-) )
Const clDeparture As Long = 123
Const clArrival As Long = 233
Dim lHour As Long
Dim lMinute As Long
Dim alHour(25) As Long
[Code]...
in one textbox i have 10:00 PM and in another textbox i have 12:00 PM....i want to subtract 10:00 PM from 12:00 PM and get result ie 2 hours...how can i perform that?
DateTime.TryParse(TextBox1.Text, d1)
DateTime.TryParse(TextBox2.Text, d2)
the code is to convert the text into time.
[code].....
I use a masked textbox, and I would control the input, the problem is, I use 1 textbox and the control should on the first 2 digits with a maximum of 24 and the last 2 digits with a maximum of 60. Is there a possibility to program this?
View 1 RepliesHere is the code. The only problem I am having is getting the total miles to display. How do I get my listbox to show my total miles broken down to hour1 xx miles. I can get it to show the total miles per total hours driven.
Option Strict On
Public Class frmDistanceTraveled
Private Sub btnCalculateDistance_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateDistance.Click
' The btnCalculateDistance event hadler calculates the distance
' traveled
[Code] .....
I get a return value from a web service in minutes, for example 538 minutes. I need to break this down in hours and minutes. What is the fastest way, in .net code and also VB6 code (two apps use the service) to convert this from minutes to HH:mm?
View 6 RepliesI have this homework assignment where we have to create a pay calculator where you would enter the total minutes worked and the hourly pay rate. and then i have to create the code to show what the total weekly pay would be. I have to display the Hours Worked: and the Leftover minutes: I also know that the formula to calculate the weekly pay is totalMinutesWorked / 60 = hoursWorked and i have to use the Mod operator. [code]
View 2 RepliesI wrote a VB.NET Windows Service, which works fine. I have only one issue with it. I want the service to execute on the half hour and top of the hour marks (e.g. 9:00, 9:30, 10:00, 10:30, 11:00, etc etc etc). I am using the following code:
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
[CODE]...
This code works, however, if the service starts at, say, 10:15, then it executes at 10:15, 10:45, 11:15, 11:45. How do I make it so it always executes on the 30 minute and top of the hour marks?
So let's say I have 1400, I want to convert it into 2:00PM I tried the following:Dim convertedTime As String = DateTime.ParseExact(theTime,"HHmm", Nothing)
And it would give me this: 6/12/2012 02:00:00 PM
I do not want the date part, neither do I need the seconds. All I need is 2:00PM
How do I code the total cost to give me a pound sign with the total cost at the moment when the total comes up for an example it gives me 3.6 when I need it to show £3.60 here is the code I have so far. [code]
View 2 RepliesI am looking for formula that is accurate in converting Minutes to Decimal Minutes i.e 30 minutes is 50 Minutes in Decimals so 1.3 hours is 1.50 and not 1.5 i have used Minutes/60 but it is not accurate as some times i have to Multiply the result by 100 and some time 1000 to get correct results based on single digit Try 1/60, 10/60 99/60 or 100/60.What would be the most efficient and correct way to Convert the time into Minutes ?
View 10 RepliesThe pay rates for the project are:
a. Level 1 - $10.00
b. Level 2 - $12.00
c. Level 3 - $14.00
d. Level 4 - $16.00
e. Benefit Deduction Rate - 0.10
f. Overtime Factor - 1.5
For ease of program maintenance, all of the above rates and factors must be stored in module level constants. All references to pay rates in the program must refer to the module level constants.
When the Calculate button is clicked:
a. The value in the Hours text box must be validated to insure that it is numeric value greater than zero.
1. If the value is not valid, a message box must appear as shown below and the user must be offered the option to continue processing or quit the program.
2. If the user chooses to continue processing, the focus must be set to the Hours text box.
3. If the user chooses to quit, the program must close immediately.
b. If the value is valid, the program must calculate and display the total pay in the Total Pay label.
1. The pay rate is determined by which Job Grade radio button is checked.
2. For hours less than or equal to 40, the total pay is the hours times the pay rate.
3. For hours greater than 40, the total pay is 40 hours times the pay rate plus the hours in excess of 40 hours times the pay rate times the Overtime Factor.
4. If the Full Time radio button is selected, the total pay must be reduced by the Benefit Deduction Rate.
5. The value displayed in the Total Pay label must be formatted with a dollar sign and with two decimal
places.
6. The focus must be set to the Hours text box.
Why i get an error when i try to run this code
Code:
Also the message box, both yes and no close the program.....
I am working with VB 2008. I want to be able to run this program say in N: and it will show me in an excel sheet the following:
Folder Path Size(GB) Count of Files
N:Clients 0.53 308
where clients contains subfolders and files and the size is the total of all those files within each folder and the count is the total within each folder also.
This works fine as it is but i have to select one by one the top level folders and some of them are huge so it takes forever to give me an answer.
1) I would like to see in my spreadsheet the following by only select the network drive n:
Folder Path Size(GB) Count of Files
N:Clients 0.53 308
N:Software 10.7 15430
N:Billing 0.98 105
2) I would also like to know if this is the faster method.
3) I tried adding a progress bar so that the user can have an idea of how much this will take but i had to remove because it was not working.
4) I would like to see the folder name, size of folder and count of files in the listview.
Here is the code:
Imports Microsoft
Imports Microsoft.Win32
Imports Microsoft.Win32.Registry
Imports System.Collections
[code].....
I am using visual basic 2008 amd creatomg a datagrodview format like below [code] Now I wnat to get total balance in total column after less discount in percentage with ENTER EVENT proceedure and get the whole total column balance in a textbox i.e Net BalanceTextBox. Please tell me how to calculate discount in percent % and get total in total column and also tell me how to move cursor in next cell instead of bottom row in datagridview.
View 2 RepliesI have 3 columns in a unbound datagridview, "length" "height" and "Total". Total = length x width and the final total in TextBox outside of the Grid. I found question simalar in this forum and tried the code but i am getting errors.The following is the code i am using
Public
Class Form1
Dim UnboundColumn[code]...
I have an application that provides a countdown for 60 minutes and I'm currently using the win form timer and it updates some labels and a progressbar. Now I have to change this to be a countdown for 360 minutes. Will the win form timer be sufficient or should I implement a Timers.Timer instead?
View 6 RepliesI'm new to forums as well as new to VB 2008. I'm in process of making a order calculator which will total any values you selected in combo boxes/checkboxes and then display it in a selected area. There are 3 things that I want to achieve: 1. Be able to add another total to an existing total (currently I'm able to see only one total when I hit "Calculate" button)2. Display how many orders I have made so far (new total counts as one order)3. Be able to add up checkboxes selected to an overall total. (when I try to add up one checkbox with another it seems to be stuck on 1.5 pounds which I assigned for each "side order")
View 4 RepliesI am stumpted when it comes to getting the current system hour.
View 3 RepliesghtSavingTime to the hour
View 3 RepliesI thought i had coded correctly to catch the Daylight savings time change, apperantly not.
Here is the code that I used:
If Today.IsDaylightSavingTime() Then
Day = DateTime.Now.AddHours(-1)
Else
Day = DateTime.Now()
End If
I've written a console utility to set file date/time stamps to a specified date/time:
For Each FoundFile In My.Computer.FileSystem.GetFiles(FileSpecPath, FileIO.SearchOption.SearchTopLevelOnly, WildCards) FileInfo = My.Computer.FileSystem.GetFileInfo(FoundFile) System.IO.File.SetCreationTime(FileInfo.FullName, NewDate) System.IO.File.SetLastWriteTime(FileInfo.FullName, NewDate) System.IO.File.SetLastAccessTime(FileInfo.FullName, NewDate) Console.Write(FileInfo.Name + " " + NewDate)Next
When I go to a command prompt to check the results, the new date is correct, but the hour is off by 1 hour. Same when I check the times in Windows Explorer -- all three times are displayed to the same time, but exactly 1 hour earlier.The system date/time are correct (Vista) and we are not in DST.The files reside on a local drive (not a network share).The computer is not on a domain.
I have a problem with a application, when i start the program the speed is ok.after 1 hour of use the prohram go very slow.
View 7 RepliesI tried to convert my VB6 code to VB2005 and it seems like some syntax cannot be use. I had tried to make it work but it still failling me.how to create a delay timer which can delay up to 5 hours and this will repeatly in 10 loops.
View 8 RepliesI have a windows service in VB.NET 2008 and want to fire an event every hour on the hour within the service?
I have this working in an application were i assign the current hour to a variable and check each minute if the variable has changed. Is there a cleaner way of achieving this in a service?
I also want the service to read this in form an XML file i have modified from a service control app can i use app.config for this as i've read your not supposed to write to this file?
I am using a textbox in vb.net but the input should be an hour format for example, "13h30". How can I enfprce this by a user? When he puts the first 2 digits like 13 then automaticly the appl. puts a "h" between?
View 1 RepliesI'm working on a program that records date metadata from files, such as creation time, last modified time, etc. An old version of the program is written in VBA, and does something like this: [Code] Both functions are running on the same machine, checking the same file. I've also tried using the IO.FileInfo class with the same result. I've checked thousands of files and they are all off by one hour. The other date properties for creation time and last modified time are also off by one hour.
I forgot to mention in the original post, The computer's time zone is CST, and daylight savings time is currently not in effect. I've reproduced the problem on Windows 7 64 bit and Windows XP 32 bit.
everyone who suggested trying to calculate the desired date from UTC using the appropriate time zone offsets. At this time I'm deciding its not worth the risk to do so. For this particular business requirement, its much better to say the date value is not what you expected it to be because thats just the way the API works. If I attempt to "fix" this then I own it, and I'd rather not.
Just for kicks I tried using the good old Scripting.FileSystemObject via interop. It gives the expected results that agree with Windows Explorer, with about a 5x performance penalty compared to System.IO. If it turns out I must get dates that match what Windows Explorer has, I will bite the bullet and go this route. [Code]
in one textbox i have 10:00 PM and in another textbox i have 12:00 PM....i want to subtract 10:00 PM from 12:00 PM and get result ie 2 hours...how can i perform that?
DateTime.TryParse(TextBox1.Text, d1)
DateTime.TryParse(TextBox2.Text, d2)
How would I go about creating a Timer that will fire an Event every 24 hours, 2 minutes? I know the Interval in ms is 86,420,000, but of course the Timer Interval will not go that high. Do I have to have a series of Timers to go off every minute until 24 hours is reached???
View 6 RepliesSay I convert some seconds into the TimeSpan object like this:
Dim sec = 1254234568 Dim t As TimeSpan = TimeSpan.FromSeconds(sec)
How do I format the TimeSpan object into a format like the following:
>105hr 56mn 47sec Is there a built-in function or do I need to write a custom function?