Results 1 to 4 of 4

Thread: Date Format

  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If oMonth = Format(Date, "MM") returns 06. How can I increment the month by one to return 07.

    oMonth = Format(Date, "MM")+1 returns 7 not 07


    Thanks,
    John

  2. #2
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post
    [quote name='jstevens' post='782375' date='29-Jun-2009 20:08']If oMonth = Format(Date, "MM") returns 06. How can I increment the month by one to return 07.

    oMonth = Format(Date, "MM")+1 returns 7 not 07

    Thanks,
    John[/quote]

    Try
    oMonth = Format(month(Date)+1, "00")
    Regards
    Don

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Don's solution is the shortest one, but just for fun here's another way to do it:

    oMonth = Format(DateAdd("m", 1, Date), "mm")

  4. #4
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Don/Hans,

    Thank you for your suggestions.

    John

Posting Permissions

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