Results 1 to 7 of 7

Thread: Find last month

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    154

    Question Find last month

    Hey All,

    I'm trying to find an easy way to find what last month was.

    I am using the following code to find the current month...


    Label1.Caption = Format$(Now, "mmm")


    Is there not an easy way to subtract one month from this
    statement, so the label would read "Sep" instead of "Oct"?

    Thanks in advance,
    Ron

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    Dateadd("m", -1, now)

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    154
    Hey Jordan,

    Thanks, but that gives me this result...

    9/25/02
    11:06:19 AM

    I just need it to read - "Sep"

    Any other ideas?

    Thanks,
    Ron

  4. #4
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    I assumed you could manage that bit!

    If you can get "Now" to read "Oct" using
    Label1.Caption = Format$(Now, "mmm")

    I thought that you would be able to format a date that shows September to be just the month?

    label1.Caption = format$(Dateadd("m", -1, now),"mmm")

  5. #5
    Hyperactive Member brenaaro's Avatar
    Join Date
    Sep 2001
    Location
    Montreal, Canada
    Posts
    391
    Pass the Date variable that DateAdd() returns into your Format() call (instead of Now)
    And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. MsgBox Month(Now) - 1

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    154
    Hey guys thanks alot :-)

    Sorry for being an idiot today...sometimes I don't know if I'm
    coming or going.

    Thanks,
    Ron

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