+ Reply to Thread
Results 1 to 5 of 5

Why does the wrong month show up

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-03-2009
    Location
    Anchorage, Alaska, USA
    MS-Off Ver
    Office 365
    Posts
    113

    Why does the wrong month show up

    Hi,

    I'm writing this in April 2024, in case anyone some months later is wondering why I'm getting the results I am.

    In VBA, I get this :

    MsgBox Now 4/10/2024 11:27:19 AM
    MsgBox Year(Now) 2024
    MsgBox Month(Now) 4
    MsgBox Format(Month(Now),"00") 04
    MsgBox Format(Month(Now),"MMMM") January


    Why do I get January? Did Daylight Savings Time hit especially hard in 2024?
    Last edited by akedm; 04-10-2024 at 03:58 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,964

    Re: Why does the wrong month show up

    Because it should be MsgBox Format(Now, "MMMM")
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,964

    Re: Why does the wrong month show up

    With formulae:

    =NOW() 10/04/2024 21:18
    =TEXT(NOW(),"dd") 10
    =TEXT(NOW(),"ddd") Wed
    =TEXT(NOW(),"dddd") Wednesday
    =TEXT(NOW(),"mm") 04
    =TEXT(NOW(),"mmm") Apr
    =TEXT(NOW(),"mmmm") April
    =TEXT(NOW(),"mmmmm") A
    =TEXT(NOW(),"y") 24
    =TEXT(NOW(),"yy") 24
    =TEXT(NOW(),"yyy") 2024
    =TEXT(NOW(),"yyyy") 2024
    =TEXT(NOW(),"h") 21
    =TEXT(NOW(),"hh") 21
    =TEXT(NOW(),"m") 4
    =TEXT(NOW(),"mm") 04
    =TEXT(NOW(),"s") 20
    =TEXT(NOW(),"ss") 20
    =TEXT(NOW(),"0") 45393

    In VBA code, replace TEXT with Format, and NOW() with just Now.

  4. #4
    Forum Contributor
    Join Date
    04-03-2009
    Location
    Anchorage, Alaska, USA
    MS-Off Ver
    Office 365
    Posts
    113

    Re: Why does the wrong month show up

    Yeah, yeah - I'm seeing that now. I was playing around with it based on your first answer, and as you were composing your second response. Turns out I was just getting lucky with the other way I was doing it...up to a point.

    Thanks .

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,964

    Re: Why does the wrong month show up

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 01-13-2023, 12:10 PM
  2. Formula to show hours base on month column and phase wise month and year
    By mtakawane in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-28-2022, 09:12 AM
  3. Replies: 3
    Last Post: 07-02-2019, 08:55 AM
  4. Autosum every three months based on month selected - Show three month trend
    By whatever 2233 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-04-2018, 07:43 PM
  5. Month over Month formula to show increase or decrease in rankings for SEO
    By lindsbay in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-12-2014, 03:03 AM
  6. [SOLVED] display cell to show only Month/year to do sumif calc if today()= any day of month
    By fireguy7 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2013, 06:55 PM
  7. TEXT & MONTH Formulas returning wrong Month
    By dwoodrocksyourb in forum Excel General
    Replies: 2
    Last Post: 10-07-2010, 10:52 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1