datetime to integer

Page 1 of 1

3 Replies - 17233 Views - Last Post: 06 October 2008 - 05:22 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=66325&amp;s=4aac75693d96c74ed99d6b4ce0f0ba22&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#1 luisorosco

Reputation: 0
• Posts: 1
• Joined: 05-October 08

datetime to integer

Posted 05 October 2008 - 07:29 PM

i M trying to convert a time span (the difference of two datetimepickers into an integer so i can used to charge a X amount of dollars per day.

is that possible?

```Option Strict On
Public Class RentForm

Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click
'figure the rental cost
Dim datebegday As Date 'day of car pick up
Dim datelastday As Date 'day of car drop off
Dim dectotal As Decimal 'total cost of rental service
Dim intdays As Integer ' total of day rented
Dim decmiles As Decimal ' total of miles added

'get the user data input

datebegday = Date.Parse(pickuptimepicker.Text)
datelastday = Date.Parse(returnTimePicker.Text)

'figure total

in a beginner.. can you tell?
```

Is This A Good Question/Topic? 0

Replies To: datetime to integer

#2 thava

• D.I.C Lover

Reputation: 180
• Posts: 1,606
• Joined: 17-April 07

Re: datetime to integer

Posted 05 October 2008 - 07:41 PM

i think it's in vb.net

lets try the datediff method in vb.net will return the no of days you should multiply the amount with that day for more reference use the following link

http://msdn.microsof...t6f(VS.80).aspx

next time post the question in the correct form then only you will get immediate response

#3 PsychoCoder

Reputation: 1646
• Posts: 19,853
• Joined: 26-July 07

Re: datetime to integer

Posted 05 October 2008 - 07:42 PM

Moved to VB.NET

#4 magicmonkey

• D.I.C Regular

Reputation: 106
• Posts: 484
• Joined: 12-September 08

Re: datetime to integer

Posted 06 October 2008 - 05:22 AM

You could also use a TimeSpan by doing something like...

```Days = EndDate.Subtract(StartDate).TotalDays

```