Results 1 to 4 of 4

Thread: [RESOLVED] Plussing one minute...

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Resolved [RESOLVED] Plussing one minute...

    Code:
    Private Function GetTimePlus(Time_ As String) As String
    
    Dim Time_Split() As String
    Dim Meridiam As String
    
    Time_Split() = Split(Time_, ":")
    
    Meridiam = Right(Time_, 2)
    
    'Time_Split(1) = Format(Left(Time_Split(1), 2), "##")
    
    Time_Split(1) = Time_Split(1) + 1
    
    If Time_Split(1) >= 60 Then
    Time_Split(0) = Time_Split(0) + 1
    Time_Split(1) = "00"
    If Time_Split(0) = 12 Then
    If Meridiam = "AM" Then
    Meridiam = "PM"
    Else
    Meridiam = "AM"
    End If
    End If
    End If
    
    If Time_Split(0) > 12 Then
    Time_Split(0) = 1
    End If
    
    GetTimePlus = Format(Time_Split(0), "##") & ":" & Format(Time_Split(1), "##") & ":" & Format(Time_Split(2), "##") & " " & Meridiam
    
    End Function
    This keeps returning strings like "1:5:1 AM"

    Local Time here is 1:06:00 AM

    I'm trying to plus one minute onto the current time.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Plussing one minute...

    It is much easier to use the built-in functions, such as DateAdd:
    Code:
    NewTime = DateAdd("n",1, Time)
    "n" is to say you want to add miNutes, 1 for the amount, and Time for the value (the current time) that you want to add it to.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Re: Plussing one minute...

    Oh dude i love you. In the most professional way possible of course.

    I never knew about that!

  4. #4
    New Member
    Join Date
    Aug 2007
    Posts
    6

    Re: [RESOLVED] Plussing one minute...

    si_the_geek u r great man,what ever i say to praise u is less,briliant man briliant

Posting Permissions

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



Click Here to Expand Forum to Full Width