Math Using Dates And Times?
Jun 17, 2010I am trying to create a small application which does mathematical calculations using dates and times. Specifically, to determine the period of time between two specific dates and times.
View 2 RepliesI am trying to create a small application which does mathematical calculations using dates and times. Specifically, to determine the period of time between two specific dates and times.
View 2 RepliesI am having issues with the Arabic language when trying to display dates and times. I seem to be unable to get the formatting to work on a date, or on a time, but it works on a date and time. Other languages seem to be fine. Any thoughts on why this is? (see image link below) Also, the Arabic formatted date is very different than the normal date (e.g. 8/20/2010 is showing as 10/09/31). Is this accurate?
[Code]...
Im using VB to set default dates and times for the file names when a form is saved through InfoPath, this is what I have so far:
[code...]
This works but i need to format it to this:
ddmmyyy and hhmmss
I need zero's before single characters as if its only a single character then it only displays 1 eg if its 9 in the morning it'll display 9 rather than 09 and i need 09.
I have now started posting to a MySQL database created by someone else. I have no ability to change the table structure.Two questions:
1) There is a date field and a time field that loosely tracks the last edit date and time. Both are fields set up as DateTime in the database. The date field always has the proper date but the date and time portion shows as
2011-11-27 00:00:00
However, the time field shows as
1899-12-30 23:16:58.
When I am updating with the following code
strSQLCmd.Parameters.AddWithValue("@EditDate", Date.Now)
strSQLCmd.Parameters.AddWithValue("@EditTime", TimeOfDay)
The date field displays
2011-11-27 23:40:26
and the time field displays
0001-01-01 23:40:26
I'm not sure how to format the date field without time and the time field with Dec 30 1899.Question 2) I will be adding some tables and will be wanting to track date and time of first entry as well as date and time of last edit. (this may have been better posted in the Database forum, if so, sorry)
For those of you who have done this before, would you mind sharing best practises? I am wondering why would you use two fields, one for date and one for time, when the field is a date/time field to begin with. I've seen this before in another database as well. I'm just trying to work out the logic here.
Is it just me or is it so that a DateTimePicker can only be used for entering dates or times but not both?
View 9 Replieswell i am having a couple of issues with this particular homework problem and this is my first programming class so there is probably quite a few mistakes well the homework problem is to take three double values entered by a user and display the largest and smallest using math.max and math.min and display the smallest and largest so i thought i could use a listbox and take the values that went to the listbox and assign variables to each so i can try to use each variable in the math.max and min but im not making it to far and i actually might be way off
[Code]...
I want my program to be able to create a '.txt' file when it is run for the first time, with the date and time the program was accessed, and to be able to add new 'logs' of program history every time it is accessed. What i mean is that i want my program to be able to create a '.txt' file, and then fill in the dates and times when the program is opened.
View 7 Replies[Code]...
and Also statment to search between 2 Times. [URL]
I want to enlarge an image, possibly up to 32 times or 64 times bigger than original dimensions (so that the user can see each pixel) if possible. The following is a simple function that I have to enlarge an image.
Private Function xEnlarge(ByVal Source As Image, ByVal Rate As Double, Optional ByVal Quality As Drawing2D.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic) As Image
[Code].....
I have two dates. [code] How to print all dates between these two dates in one listbox, for example: [code]
View 8 RepliesSay the user specifies these two dates....
Start Date: 2010-12-05
End Date: 2011-01-15
If I select December 2010 I should get the folllowing
startdate = 2010-12-05
enddate = 2010-12-31
Select January 2011 then
startdate = 2011-01-01
enddate = 2011-01-15
Should I subtract dates? How can I get the start and enddate for the current month/year based on the overall start and end date.I'm coding in vb.net.
I'm using two datetimepicker controls to set the start and end dates for a range of dates I'm searching for.I want to make sure that the start date selected is not greater than the end date. This code works, but it runs the messagebox prompt twice for some reason. I've tried to ignore it from doing this, but it's not working. Can someone tell me what's wrong?
Private Sub dtpStart_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpStart.ValueChanged
[Code]...
I have just started using vb.net and I have a checked list box with times throughout the day shown as
00:00 - 00:14
00:15 - 00:29
00:30 - 00:44
00:45 - 00:59
What I am trying to find is a way to get the current time and find which list item it fits into. What I think I need to do is to first of all get the current time and then go through the list splitting each item into 2 times and seeing if the current time fits. For example: Split the item 00:00 - 00:14 to 00:00 and 00:14 and then check if the current time is more than 00:00:00 but less than 00:14:59 and if so do certain task.how to go about taking each list item and splitting it into 2 separate times so I can check between them?
I have one more problem with MonthControl.And when I bold some dates the program doesn't show bold dates on month calendar.When I move on next or previous month and get back to currently month the program normal displays bold dates. What's the problem?
View 22 RepliesI,m developing a debt calculation program 'my problem is when i have to calculate the months to pay back the debt it comes to 28.04 and i have to get it to 29 my code looks like this:
[Code]...
How can I round 4.39 to 5 in VB.NET? I tried:
Math.Round(4.39, 0)
But it displays 4.
I am trying to perform a simple multiplication in vb.
Below is my code:
Dim minus As Integer
Dim minusPrice As Integer
Dim totalPrice As Integer
[Code].....
I've been having a problem with Math.Log in a function I'm trying to write. When working with variables, it always returns 0. Here's the line I'm trying to run:
Quote:
mb = txtMb.Text
k = txtK.Text
t = txtT.Text
[Code].....
I am trying to use Math.round. now my math.round (2.5) converting it to 2. O want to convert it to 3.
View 6 RepliesI am trying to do math (-, +, *, etc) based on what a user selects from a combo box. The combo has the operators (-, +, *, /) in its items list. when the user selects one of them, I want to use that operator with the two numbers the user also provides from two text boxes.
dim intNumOne as integer
dim intNumTwo as integer
dim intAnswer as integer
[Code]....
'I don't think I want to concatenate here. but this is what I would like to happen (use the operator based on the users selection from the combo and the two numbers from the text boxes. I know I could write a select case or If statement but is there a way to do what I'm trying to do without Select Case or If? I tried to make theOperator a 'char' type variable but that didn't work either.
Is there any way to parse a string in vb.net (like, built in methods), that can do math like Eval can? For example, 3+(7/3.5) as a string would return 2.
I am not asking for you to code this for me, I just want to know if there is a built in way to do this, if there is not I will code it myself.
I can wager that it would not be able to parse stuff like Sin(90) on its own, and I understand that would need to be replaced by Math.Sin(90).
I have tried following coding to get highest value.EX: If I type 4.341111111111, It should get the value 4.35. If I type 9.132222, It should be 9.14 not 9.13.[code]
View 9 RepliesI am building a tool to figure out final value fees. This is the math i have to try to code
$1,000.01 or more 8.75% of the initial $50.00, plus 4.0% of the next $50.01 - $1,000.00, plus 2.0% of the remaining final sale price balance ($1,000.01 - final sale price)
I'm using .Net 3.51 SP1. I've been having problems with .Net's inability to add single numbers, could anyone throw some light on this.
[Code]...
I have a strange result coming from some big math & have no clue as to why I'm getting a different answer from vb.net vs python.Here are the quick snippets & results:
VB.NET
Dim MSB As UInt32 = 3067297518
Dim LSB As UInt32 = 1439785590
[code]......
I've a problem using simple logarithm function Log in some ButtonClick Event. Log is underlined with next warning:System.Diagnostics.Log is not accessible in this context because it is Friend.
Have I missed something or this happens because of the Express version of Visual Basic?
1. The lens equation for a camera is 1/f=1/di+1/de , where f is the focal length of the lens, is the distance between the lens and the film, and is the distance between the lens and the object. For a certain camera, an object that is 18 cm from the lens is in focus when the lens is 9 cm from the film. What is the focal length of the lens?
View 1 RepliesIs there some interface I can implement to allow basic comparisons and math to happen as it would an integer?
For example, let's say I have the following class:
Public Class Something
Public SomeBigNumber as UInt64
End Class
I would like to do something like this:
Dim SomethingA, SomethingB, SomethingC as New Something
....
If (SomethingA-SomethingB) > SomethingC Then
'Do stuff
End If
I was hoping to be able to implement some interface (if that is even the right term for it) that would return the UInt64 contained in the class for comparison and math, if possible.
I have to use a round method that follows this behavior:
7.00 -> round -> 7
7.50 -> round -> 7
7.51 -> round -> 8
I tried to use Math.Round, but it works a little bit different.
[Code]...
How can I implement my rounding logic?
How to get numbers from a text box then use them in a math operation.
View 4 Replies