SoFunction
Updated on 2025-03-06

C# Message Time Format

Platform: Vs2012
It mainly implements the display of space publication talk time, such as: someone replied to you 10 seconds ago, which can be used in web browsers, forms, etc.

namespace test
{
  class Program
  {
    static void Main(string[] args)
    {
      DateTime now = ;
      DateTime time = ( "2014-03-17 11:02:00");
      TimeSpan ts = now - time;
      if ( == )
      {
        if ( < 1 &&  == )
        {
          if ( < 1)
          {
            if ( < 1)
            {
              string s=() + "I love me a second time and don't leave a message to you";
              (s);
              ();
              return;
            }
            string a = () + "I love me a minute ago and don't leave a message to you";
             (a);
             ();
             return;
          }
          string b = "today " + ("HH:mm") + "Love me and don't leave a message to you";
          (b);
          ();
          return;
        }
        (()+"moon" + () +"day"+ ("#00")+"hours" + ("#00")+"minutes ago"+"He who loves you left you a message");      }
      ();
    }
  }
}

A function that calculates two time difference values ​​and returns the absolute value of the time difference:

     private string DateDiff(DateTime DateTime1,DateTime DateTime2)
     {
       string dateDiff=null;
       try
       {
         TimeSpan ts1=new  TimeSpan();
         TimeSpan ts2=new  TimeSpan();
         TimeSpan ts=(ts2).Duration();
         dateDiff=()+"sky"
             +()+"Hour"
             +()+"minute"
             +()+"Second";
       }
       catch
       {
       }
       return dateDiff;
     }

The above is the entire content of this article, I hope you like it.