Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Rounding Time Unit To 15 Minutes

I am currently writing a program that records the number of hours worked on projects to the nearest 15 minutes.

The most common error that users are making is inputting
2hrs 15mins as 2:15 rather than the required 2:25

Has anyone got a routine that would round the minutes worked?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
What's The Time Unit For Linktimeout?
Hello, Everyone:
One of my Text box has DDE link. The default time is 50. Is that 50 second or 5 second? Thank you very much!

Check Every Unit Of Time?
i know how to make an object do something when clicked, or when there's a key press, but is there a way to make it do something every unit of time?

Retrieving Data From A Time Control Unit
I must write a salary program for a factory owner who wants to purchase a time control unit so that his employees can pull their cards through this when they clock in and out. The problem is: how on earth does the program retrieve the times and the card details from the time control unit? I've seen a similar program - the PC and the time control are connected by serial ports, but the time control is not installed as hardware anywhere on the PC.

Calculating A Compound Unit Value To Its Unit Value(VB6-SQL)

This's my first post. I hope this would be welcomed.

I have a small question here. I have two tables 'Units' and 'Compound' units and some data has been provided here to make you guys a little clear about the question.

I want to make an SQL query which returns the basic unit of a compound unit.

FYI, here we have two tables 'Units' and 'CompoundUnits'

----- Table Name = Units --------



--------- Table Name = CompoundUnits ------------

UnitNameShortCut UnitMultiple
Dozen dz Pieces12


Cartoon is a compound unit.

According to the above data ..

Cartoon = 500 Box
Box = 100 Packet
Packet = 15 Dozen
Dozen = 12 Pieces

Pieces itself is a basic unit.

Now coming to question ...

Please do help me make an SQL Stored Procedure or a VB 6 Function in which when a Compound Unit (Eg. Cartoon) is passed, returns its value in basic unit(Pieces).

Add Minutes To A Time
Hi, all

anyone know how to add minutes to time? I want to add 15 minutes to 08:00 AM.

VB Code:
Dim Time as DateTime = #08:00# Time = Time + (myminuteshere)'This would produce 08:15 AM for example  

Thanks in advance

Add 30 Minutes To Time? (hh:mm)
I can add day's to months using cvdate, but it does not seem to work with time formatted hh:mm. I wish to add 30 minutes to time stored in a variable. How can i do thsi please?


Add 30 Minutes To Time? (hh:mm)
I can add day's to months using cvdate, but it does not seem to work with time formatted hh:mm. I wish to add 30 minutes to time stored in a variable. How can i do thsi please?


Looking For Someone With 15 Minutes Time
Because I have no experience with VBA I ask you kind people. I have to make this program:
You ask the user for the number of throws
Then you throw a dice (1 to 6) that kind of number and show what the results are in one messagebox. For example:
give number of throws: 5
and then you show:
4 6 2 1 4
This is possible in less then 15 minutes and I can't do this. Is there someone who can do this for me. I will be grateful for it. Gr

Adding 30 Minutes To Time Value
Easy question.

I want to add 30 minutes to the timedate() value within a label. How do I do that?

Chris, Baltimore.

Adding Minutes To A Time
How can I add for example 7 mintutes to the current time, and have it go back to the top of the hour when it's over 60 minutes, and if it's 11:55:00 PM it'll give 12:02:00 AM. The seconds and time of day are crucial.

Is there a module or already some set code that will do this so I don't have to do this the long way I'm doing right now (cuting and slicing a current time).

Adding Minutes To Time

I am sure that is I have just temporarily lack od inteligence....

Here is what I would like to do.
On my form I have textbox with time in it (like 19:12:25).
I would like to add minutes (like 30, 122, 94...) to that time and get the result in format 15:14:12 like I have in textbox.

How to do that?
I tryed with Time1 + Time2 and I had no luck....

Elapsed Time In Minutes
I have an application where my users give me a time and I need to get the elapsed minutes from 7:00 am. Is their a function or easy way to do this ?

TIA for any help!

Adding Minutes To Time
hi all,

how can i add minutes(suppose 10 minutes) to current system time


How Can I Add Minutes To A Time In Javascript
Hi guys,

sorry to post this here but I am very very very in a rush!!

is there a dateAdd() function in javascript like in VB,

tx for your time!!

How To Calculate Minutes Into Time
If I have a var that has 243 in it, how would I calcualte that to minutes.

I would want it to read 0:04:03.


Edited by - Adobe on 5/10/2005 1:13:31 PM

Just Few Minutes Of Your Valuble Time Please...
I had used the OpenText method of workbook to open a text file, delimited with "|". The command runs like this

XlApp.WorkBooks.OpenText FName, xlMsDos, 1, Delimited, xlTextQualifierDoubleQuote, False, False, False, False, False,True, Chr(124), Array(Array(1,9),Array(2,1)...)

The problem is that the Last Parameter that is the FieldInfo is not a constant. With each file it will differ.

Please help me to put a string in the Array Place.


Adding Minutes To A Supplied Time
I need to compare to times. However, the second time needs to be greater than the first time by at least 9 minutes.

This is what i had first:

So I need it to be something like this:
>TimeValue([txtTFrom].[Value]) + 10

But, as you can guess, that didn't work.

Anyone know how to add an additional 10 minutes to a given time?

Trying To Understand The Time In Hours. Minutes.....
I have this code:

VB Code:
Private Sub Form_Load()    Timer1.Interval = 100   'fire timer    Timer1.Enabled = True    Timer1.Interval = 60000 '1 minuteEnd Sub Private Sub Timer1_Timer()Static iCounter As Integer     If iCounter = 60 Then        'do something        iCounter = 0    End If    iCounter = iCounter + 1 End Sub

60 supposed to me 1 hour, but for some reason its not, it 60 milliseconds, for the iCounter to be one hour it I should enter 240000.

whats the right timing formate using hour, minutes, second and when using the hour to be 60 min instead of using seconds or milliseconds.


Round Time To The Nearest 15 Minutes?
Does anyone have a lil function / know how to round time to the nearest 15 minutes?

I have broken the day up into 15 minute intervals, and I would like to be able to default to the current interval.

08:40 = 08:30
06:16 = 06:15

Does this make sense?

Thanks alot for your help.

How Can I Calculate The Hours:minutes Between To Time Values
Hi all,

I need to calculate the time difference between a start time and an endtime in this format hours:minutes eg. 1:05.

My time values are in this format hh:mm:ss AM/PM.

Thanks in advance.

Finding Differences In Time - Calculating Minutes
I have tried several ways to do this but to this point am unsucessful. If anyone knows how to accomplish the following please let me know

This has to do with time schedules
I have this data

Start Lunch End
8:00am 11:30am 5:00pm

What I need the code to do is give me the minutes they were scheduled to work and if lunch exists then subtract 60 minutes.

Thanks for any help

Hour(Time) Function; Similar One For Seconds/Minutes?
Are there functions in VB6 that return the minutes and/or seconds of a time variable like the Hour() function that takes a time as its parameter and returns the hour?

Adding Hours/minutes/secs To Current Time?
hi everyone,

i hope someone out there will be able to help me...

is there a preset function that will add, like, 5 minutes (or 5 hours or 12 secs) to the current time?

i've looked everywhere and found nothing.

thanks in advance.

Brain Pain... Round Up Time To Nearest 5 Minutes ?
Anyone help out a poor chap withbrain pain ? I simply cannot think of the algorythm to round up the current time to the next five minutes..

humble apologies for such a crass post but all help gratefully received !!!


Rounding, But As Time

im making an audio player... and what i need help with is,

i got the length of a track with the following

Dim haha As Double

haha = MediaPlayer1.Duration
haha = haha / 60
haha = Round(haha, 2)

i used the round function so i would be the two decimals as the seconds and the numbers before it are the minutes like

2.52 seconds

My problem is, if there is a song, that is lets say 3.20 seconds, haha gets the value of 2.80, this is wrong cause it should show 3.20 (minutes and seconds)

can anyone help pls?



Is There A Way I Can Time A DesignMode Session, To Revert Back To NORM, In 5 Minutes?
Is there away that I can execute a timer when I switch to the design mode and have the timer set for 5 minutes to revert back to the regular Mode? I'm going to have the macro attached to a tool bar button. I've written such a code before, but can't find it. I remember how to do most all of that, including switching back to normal mode, but I NEED THE CODE, to switch to Design Mode.. My way of getting back to norm, is not real pretty, to think about, but it works just fine. - As I said, I just need to know how to get in, with code. - It is fine with me, to switch to the design Mode, with the DesignMode tool bar button, if you know of a way to have a timed return to normal, that is triggered by that action. I know how to run a timer as a seperate action, that will revert me back, but the problem with that is, I might forget to trigger that proceedure, as I won't be forced to.

The resaon that I need this, is so when I make a quick code modification to a users workstation, I won't have the possibility of getting caught in a DOWN MODE, cued by me forgeting to switch back to the normal mode. - instructing my user's on how to, is not full proof, as a few tend to forget how, and end up loosing considerable time with their tasks. (stuck in a mode(ha, ha) of being too embarrassed to ask for help.

Thanks from: TboltFrank, for any and all Knowledge and/or ideas(-:

Adding And Rounding Off Time
well, i really have no idea on how to start my form so anyway...this is the idea...i have a form that basically is the interface for employee obviously i would be dealing with time-in and time-out anyway, what i want to do is to be able to round off this time-in and time-out, the seconds into minutes, den the minutes into hours...den add them all up to compute the total hours that an employee worked for that do i use a time function here?

Time - Time = ?minutes
How can I get minutes from a time to another time?

Easy Date/time Rounding Q. ***RESOLVED***
I'm trying to find the most efficient way of rounding time values to the nearest hour.
Eg "19:41:00" should read "20:00:00"
Any pointers anyone?
Thanks in advance.

Convert Hours And Minutes To Only Minutes?
I have a time in excelcell ex. 08:36. How can I convert it to only minutes?

Convert Minutes To Hour And Minutes??
I want to convert minutes to hours and minutes (alot of minutes) anyone??

Rounding Numbers To 2 Decimal Places - How To ? (Rounding)
I am returning math to a variable (and/or a text box) BUT I only want to have two or three decimal places, that are rounded off.

I cant figure out how to round them. I've tried setting text box properties, calling 'as currency' but I dont know what else to do.

Thank you.

Surrounding A Unit

I'm continuing with the FSM / AI theme and am currently implementing "teams" into a very simple game, although there's not any user input as I'm just testing AI.

So, at the moment I am trying to code some sort of surround() function for use in the team class, that causes the given unit to be surrounded by the rest of the team. I've got pretty close, but something in my code is wrong!


Public Sub Surround(ID As Integer)
'surround the given unit

Dim Counter As Integer
Dim Angle As Single
Dim CurrentAngle As Single

Dim MoveToX As Single
Dim MoveToY As Single

Angle = DegreeToRadian(360) / (TeamCurrentSize - 1)

Dim i As Integer

Debug.Print "AidUnit for Team#" & TeamID & " -> Unit#" & AidUnit & " -> " & unit(AidUnit).Center(centX) & ", " & unit(AidUnit).Center(centY)

For i = 0 To TotalUnits

If i = ID Then
'the unit cannot surround itself!
GoTo NextLoop
End If

If unit(i).intTeam <> TeamID Then
'this unit is not on my team!
GoTo NextLoop
End If

CurrentAngle = RadianToDegree(Angle) * Counter

CurrentAngle = DegreeToRadian(CurrentAngle)

MoveToX = (unit(AidUnit).Center(centX)) + (Formation_Spacing) * Sin(CurrentAngle)
MoveToY = (unit(AidUnit).Center(centY)) + (Formation_Spacing) * Cos(CurrentAngle)

Debug.Print " Unit#" & i & " -> " & RadianToDegree(Angle) & " * " & Counter & " = " & RadianToDegree(CurrentAngle)
Debug.Print " Unit#" & i & " -> " & MoveToX & ", " & MoveToY

unit(i).DirectOrder MoveToX, MoveToY, unit(AidUnit).z

'done i hope

Counter = Counter + 1

End Sub

Now, currently this code works in a "sort of" way:

(the pink unit is the unit that is meant to be surrounded)

If anyone can see anything I might have missed in my code, I'd be grateful, as currently i cannot see why the units don't surround the unit!

I hope you understand how i (tried) to implement my solution, if not I will explain how, but probably tomorrow as I'm in rather a hurry :S

so, thanks to anyone who can help!

Unit Conversion
I'm currently writing a program to interface with the OPTO22 PLC. Not sure if anyone is familiar with this, but in order to do it they give you a driver called Otpocom.dll. So in order to use the driver the manufacturer has created a list of VB commands to talk directly to the controller. Specifically the sendrecvieve command is where i have a question. You have to specifically tell the controller what type of variable you are trying to read wether it be integer, float, string, etc. Well when i try to read a float from the controller by default it comes back in scientific notation. There are no parameters to say how you would liek the result formatted so i have to do some post formatting. Is there a command to convert directly from scientific notation into a simple floating point? Or am i gonna have to write the procedure myself.

*********how To Create Our Own Unit ? *********
The settings for value are:

Constant Setting Description

vbUser 0 Indicates that one or more of the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties are set to custom values.

vbTwips 1 (Default) Twip (1440 twips per logical inch; 567 twips per logical centimeter).

vbPoints 2 Point (72 points per logical inch).

vbPixels 3 Pixel (smallest unit of monitor or printer resolution).

vbCharacters 4 Character (horizontal = 120 twips per unit; vertical = 240 twips per unit).

vbInches 5 Inch.

vbMillimeters 6 Millimeter.

vbCentimeters 7 Centimeter.

How to

using - vbUser 0 - create own unit ?

i have 3 picture box .

two pic box for ruler
3rd one is for drawing.

using vbCentimeters 7 the scale for ruler and drawing pic is getting correct referance

if i am changing to vbUser 0 - own size the ruler pic box and drawing area not in proper scale

any sample pls with vbbUser mode


Unit Converter
Hey, someone help me to make an Unit Converter.
I tried using Resource strings but there're some bugs:
Example in Angle: All are in relation to Radian so:
Degree= ????Radian,Circle=???Radian
=> Degree=???Circle. But it gen data mistake, some value is not equal, it's a bit wrong ex:0.999999999 instead of 1. Some one help me ????
I've seen Master Converter, it's so good. How can I have my own Unit Converter ???
<<< ...::: Sorry for my bad English :::... >>>

Organizational Unit In AD
How can I get name of object in organizational unit that is in AD? I try to use IADsOU but I cannot.

Grid Unit
How do I change the grid unit from twips to pixels for the entire project in VB 6.0??

Is My Unit Good?
I am trying to make my form the full width of the screen.

I am using the api call:

Public Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1

which is working correctly, returning 1024, but then when i set my form width to this, it is small.

I believe the problem is that the form width is of a different unit then pixel?? Here is the code I am using to set the width:

formName.Width = GetSystemMetrics(SM_CXSCREEN)

Am I correct that the units are wrong, and if so how do i convert?

Getmousepos Unit Of Messure
what is the units of messure with the x and y of the getmousepos pixels,twip,point ....... i really dont want to change the unit of messure to my form because then i will have to redo everything on it do that scale of messure... so is there a way i can do a ratio for twips???

Help With Network Shared Unit
Hello!!, i made a litle program in visual basic 6.0 that open a file in a network shared unit, i have a textbox with a way to the file like //pc3/c/dfdfd/, the program works well when i give the password for the unit at start of the program but when i restart the pc the program not conect whit the file becose i'm not there to open the network unit an type the password, how can i do to automatically conect putting the password with the program?
I can to map de unit locally but the program is in a pc for student users and i dont want to he see the bases (he can destroy them)
Sorry for mi english, i hope you understand me.
Thanks to all.

Regarding VB Unit Testing Tool
I'm working a tester and presently working on vbunittesting tool. Sir i'm totally confused with that tool.I followed the tutorial given by him but its totally confusing.It is describing about a string variable and a buffer, but how will i check my program whether it is working fine or not.Sir if u r comfort in telling me than plz help me and i have more doudts regarding vbunit.

Thank you


Unit Of Measure Conversion
On my data entry form need to be able to enter feet/inches/numerator and denominator for fractions of inch and display one text box as fractions and another box as decimals on the same form. Can someone advise how I go about setting a place holder in the feet, inches, fractions format. Do I have to break this up in different fields or can I have it as one field so I can update one field in a table. It would also be helpful if some one could supply the update table code as I am just beginning to learn VB and sql.

Check If Mapped Unit Is Available
Woking on this project I'm stumbling upon practical problems as described in

Now, my next question is: if I want to copy files from a unit "H:" (a mapped folder in another local network unit) and the connection is not available at the time, the copy operation will fail. What's the best way to check if the connection is available? Just attempting to copy and trap the error?

Form Size Unit? [VB6]
for the width and height options in VB6, is there a way to make the width and height properties use pixels, or is there a way to convert whatever unit VB6 uses to pixels?


How To Find And Exclude A CD Unit...?
Hello !

How do I identify a CD unit from other drives to avoid any use of it when create a directory in a program ?

I can exclude the CD unit if there is no CD in it, when pick the path in a drivelist ! Then it will show up as unavailable. But you'll never know from time to time if the user have...

Thanks for any info...


ListView Unit Problems

I have two servers in my system which use the ListView control, im having a strange problem with the measurments. In one program the code sets up the list coloumns at the correct widths, the other program using the same code (as far as i can see) makes the coloumns far too wide, yet the size settings are the same!! Is there some way to set what unit of measurment it will use?

     'Define the column headers
     With lvwClients
           .View = lvwReport
           Call .ColumnHeaders.Add(, , "Index", 700)
           Call .ColumnHeaders.Add(, , "UserName", 1900)
           Call .ColumnHeaders.Add(, , "State", 1500, vbCenter)
           Call .ColumnHeaders.Add(, , "World Name", 1700)
           Call .ColumnHeaders.Add(, , "ID", 1000, vbCenter)
           Call .ColumnHeaders.Add(, , "RemoteHostIP", 1700, vbCenter)
           Call .ColumnHeaders.Add(, , "Error", 2900)
    End With

The code is above, and on one server the Index coloumn set to 700 is fine, the other its about 10 times wider!!! how come?


Edited by - Xander on 11/12/2003 6:25:02 PM

Unit For CommandButton Height.
Hi all,
Can anybody tell me what is the unit of measurement for the height of a commandbutton control and whatever is the unit,how do I convert this unit into pixels?I mean if I want the height of my button to be 25 pixels,how do I go about doing that?
Any help would be highly appreciated.

What Measurement Unit Does Visual Basic Use?
I apologize in advance for what must be a completely inane question, but what measurement unit does Visual Basic use for Height/Width/Position/etc. properties? It seems Greek to me, and I can't make heads or tails of how to properly convert it to the much more conventional "pixel."


P.S. As a side note, is there any way for a form to be created in a position relative to a currently existing form? (ie. if one had an "about" button that generated an about form, is it possible for it to be created in a position based on the parent form?)

Copyright 2005-08, All rights reserved