+ Reply to Thread
Results 1 to 4 of 4

Code to turn 4 digit year to 2 digit

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-18-2011
    Location
    long island
    MS-Off Ver
    365
    Posts
    237

    Code to turn 4 digit year to 2 digit

    i have a code that grabs a date from a stores it in a variable
    i then what to grab the year from that date and store it in another variable but only the last two digits (2015 would become 15)
    n = Month(ddate)
    is there a change to this line to make that happen?

    Thank you

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2505
    Posts
    2,792

    Re: Code to turn 4 digit year to 2 digit

    Try this.

    n = Format(ddate, "yy")

  3. #3
    Forum Contributor
    Join Date
    12-18-2011
    Location
    long island
    MS-Off Ver
    365
    Posts
    237

    Re: Code to turn 4 digit year to 2 digit

    That did it,
    thank you!

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2505
    Posts
    2,792

    Re: Code to turn 4 digit year to 2 digit

    My pleasure, thanks for the rep. points.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. [SOLVED] Dates turn into 5-digit number
    By Wiggle12 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 09-16-2015, 07:30 AM
  2. Macro to identify 3-digit and 4-digit numbers as valid dates
    By gojakie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2015, 08:16 AM
  3. Replies: 4
    Last Post: 03-07-2015, 12:03 PM
  4. [SOLVED] convert a 4 digit zip code to 5 digit zip code
    By maacmaac in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-25-2014, 02:36 PM
  5. [SOLVED] LOTTERY FILTER#4, Find if 1 Digit Sum of 2 Digit or 3 Digit, Single Cell w/ dash
    By david gonzalez in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-08-2014, 12:57 AM
  6. Replies: 2
    Last Post: 07-05-2012, 07:30 AM
  7. Replies: 2
    Last Post: 06-17-2010, 08:36 PM

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