Jump to content

Date annoyance


d0n
 Share

Recommended Posts

So here is the problem, i have a date 01-01 (Jan 1st)

i want to add 7 days to it = 01-08 (Jan 8th)

However i am running into problems with the month of feburary 28/29 days.

what would be the best ways to do this?

$Date = '!09-30'

$Date = StringTrimLeft($Date, 1)
If StringRight($Date, 2)+7 > 31 Then
    If StringLeft($Date, 2) > 9 Then 
        $Date = "!"&StringLeft($Date, 2)
    Else
        $Date = "!0"&StringLeft($Date, 2)
    EndIf
    $Date = $Date & "-0"& (StringRight($Date, 2)+7)-31
Else
    if StringLen(StringRight($Date, 2)+7) < 2 Then
        $Date = "!"&StringLeft($Date, 2) &"-0"& StringRight($Date, 2)+7
    Else
        $Date = "!"&StringLeft($Date, 2) &"-"& StringRight($Date, 2)+7
    EndIf
EndIf

MsgBox("","",$Date)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...