Minute Difference (n)

1. Senior Member
Join Date
Dec 1969
Posts
626

## Minute Difference (n)

When I do a difference in minutes I am getting stuck!<BR><BR>mindif = DateDiff("n", rs("min"), FormatDateTime(Now,4))<BR><BR>I am using military time so rs("min") = 19:59<BR><BR>Does anyone know what I&#039;m missing here?<BR><BR>

2. Senior Member
Join Date
Dec 1969
Posts
2,854

## RE: Minute Difference (n)

I&#039;m not sure you can do this<BR><BR>mindif = DateDiff("n", rs("min"), FormatDateTime(Now,4)) <BR><BR>try<BR><BR>mindif = DateDiff("n", rs("min"), Now())

3. Senior Member
Join Date
Dec 1969
Posts
626

## RE: Minute Difference (n)

That same method works with the hour difference though..

4. Senior Member
Join Date
Dec 1969
Posts
2,854

## Also.....

no, you cant do 19:59<BR><BR>you will have o split it, and do a seperate datediff for seconds and minutes!

5. Senior Member
Join Date
Dec 1969
Posts
2,334

## datediff will give you the difference

between two "dates".<BR><BR>So the above syntax will not do you any good.<BR><BR>what values do you have in rs("min")&#062;

6. Senior Member
Join Date
Dec 1969
Posts
626

## RE: datediff will give you the difference

I&#039;m using a field called<BR>startdate : 10/12/2002<BR>min: 23:21<BR>(also a field called runtime which adds the amount of days onto the date)<BR><BR>Is there an easier way of doing this?<BR><BR>min is in military time... here&#039;s what I want it to display...<BR>Time Left: 4d 10hr 5m

7. Senior Member
Join Date
Dec 1969
Posts
2,854

## RE: Minute Difference (n)

OK, just wasn&#039;t sure, so thought I&#039;d mention the possibility! :-)<BR><BR>however, you can&#039;t do minutes:seconds in one DateAdd function, you will have to split the two out!<BR><BR>So something like<BR><BR>Dim arrTime<BR>arrTime = split(rs("time"), ":")<BR>strSeconds = int(arrTime(1) + int(arrTime(0)*60))<BR><BR>newDate = dateAdd("s", strSeconds,now())<BR><BR>I&#039;m also a little confused as to where Datediff fits in, do you not mean dateAdd?

8. Senior Member
Join Date
Dec 1969
Posts
2,334

## RE: datediff will give you the difference

mindif = DateDiff("n", rs("min"), FormatDateTime(Now,4)) <BR><BR>Let us see what we have here,<BR>rs("min") -- It is in the format hh:mm<BR>Now -- Current Date<BR><BR>So what we are trying is a difference between a time and a date.<BR><BR>I am not very sure of what do you want?<BR><BR>Need more clarification here.

9. Senior Member
Join Date
Dec 1969
Posts
626

## RE: datediff will give you the difference

I need to find the difference in minutes. Between any given minute, and now()

10. Senior Member
Join Date
Dec 1969
Posts
2,854

## RE: datediff will give you the difference

When you say "Any given minute" do you mean, any time of day?<BR><BR>like 19:59 = 7:59 PM ??<BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•