Search Unity

[c#] Question about getting just the Month and Day

Discussion in 'Scripting' started by RyanSyg, Jul 31, 2014.

  1. RyanSyg

    RyanSyg

    Joined:
    Nov 2, 2012
    Posts:
    17
    I searched and I found http://msdn.microsoft.com/en-us/library/system.datetime.now.aspx and was able to get the "7/31/2014 2:36:15 PM" to display. What I want to do is just compare month and day. I don't care about the year or time. How would I go about doing that?

    So my goal is to have something happen on a particular Month/Day regardless of time and year.

    Thanks for any help!
     
  2. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    DateTime.Now.Month and DateTime.Now.Day.
     
    CelsoDev, Polymorphik and RyanSyg like this.
  3. RyanSyg

    RyanSyg

    Joined:
    Nov 2, 2012
    Posts:
    17
    Thanks. Much easier then expected. Think I might need to slow down next time and just type in DateTime.Now. and see what the menu suggests in MonoDev.
     
  4. tsondhi2006

    tsondhi2006

    Joined:
    Sep 4, 2016
    Posts:
    10
    i tried to put in DateTime but no menu is popping up and it is highlighted in red
     
  5. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    System.DateTime

    or add
    Code (CSharp):
    1. using System;
    at the top of the script.
     
    tsondhi2006 likes this.
  6. tsondhi2006

    tsondhi2006

    Joined:
    Sep 4, 2016
    Posts:
    10
    Thank u very much.........
     
    Munchy2007 likes this.