codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Compare date / time < 5  VanJ at 04:44 on Tuesday, December 22, 2009
 

Hi All;

Struggling with something I just can’t get right, label1 display a last transaction date/time which I get from a date base throw a query label2 is the system date/time. I have a timer that execute a command button after executing the command button I want to check if the date/time in label1 is smaller than 5 minutes and if so then I get a massage. But I don’t know how all my code fails to perform this function help will be much appreciated.


Private Sub Command1_Click()

Dim date1 As Date
Dim date2 As Date


date1 = Format(Now, "yyyy/mm/dd hh:mm:ss")
date2 = Format(label1, "yyyy/mm/dd hh:mm:ss")
If DateDiff("n", date1, date2) < 2 Then
MsgBox ("Not Vending")
End If
End Sub



Private Sub Command1_Click()
Dim date1 As Date
Dim label1 As Date

date1 = Format(Now, "yyyy/mm/dd hh:mm:ss")
date2 = label1
If DateDiff("m", Now, date1) > DateDiff("m", Now, label1) Then
MsgBox ("Not Vending")
End If
End Sub


Also


Private Sub Command1_Click()

If DateDiff("n", Now, label1) > 5 Then
MsgBox ("Not Vending")
End If
End Sub










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  PING PROGRAM IN PERL
•  Need Help with a Regular Expression
•  Informations on HTML
•  Re: FREE TV on your PC!
•  Re: Using Lucene or Solr ?
•  submit button on html form
•  Re: Browse button /filedialog in perl tk:
•  how to create forum using C# code
•  Re: Perl array access


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010