HumanTimeSpanString() public static méthode

public static HumanTimeSpanString ( System.DateTime yourDate ) : string
yourDate System.DateTime
Résultat string
Exemple #1
0
 private void DrawTimeText(SpriteBatch spriteBatch, Vector2 drawPos, int baseWidth)
 {
     if (timeStamp == "0000-00-00 00:00:00")
     {
         return;
     }
     try {
         var    MyDateTime = DateTime.Parse(timeStamp);                     // parse date
         string text       = TimeHelper.HumanTimeSpanString(MyDateTime);    // get time text
         int    textWidth  = (int)Main.fontMouseText.MeasureString(text).X; // measure text width
         int    diffWidth  = baseWidth - textWidth;                         // get difference
         drawPos.X += diffWidth * 0.5f;                                     // add difference as padding
         Utils.DrawBorderString(spriteBatch, text, drawPos, Color.White, 1f, 0f, 0f, -1);
     }
     catch { }
 }
 private void DrawTimeText(SpriteBatch spriteBatch, Vector2 drawPos)
 {
     if (timeStamp == "0000-00-00 00:00:00")
     {
         return;
     }
     try
     {
         DateTime MyDateTime = DateTime.Parse(timeStamp);
         string   text       = TimeHelper.HumanTimeSpanString(MyDateTime);
         Utils.DrawBorderString(spriteBatch, "Updated: " + text, drawPos, Color.White, 1f, 0f, 0f, -1);
     }
     catch
     {
         return;
     }
 }