title: Comparing a Date from an SQLite Database to the current DateTime in C#, Xamarin Forms
body: <p>So I have generated a SQLite database in Xamarin Forms. Each item has a Name and Date. I'm trying to extract the date and set it to a variable so that when each item is loaded, it will convert its date integer to DateTime and compare it to DateTime.Now.
  I'm not sure how to do this, and I might be missing something very elementary- I'm a complete beginner.</p>
  <pre><code>public LivePage()
          {
              InitializeComponent();
  
              
              LiveService.AddLive(&quot;2022年3月19日（土）: ILLUSION FORCE presents「ILLUSION FORCE×GAUNTLET LONGSTAGE 'GACHINKO'2MAN GIG」&quot;, 20220319);
              LiveService.AddLive(&quot;2022年3月20日（日）Phantom Excaliver presents 聖剣フェス」&quot;, 202203020);
              LiveService.AddLive(&quot;2022年4月2日（土）Bad Company vol.17」&quot;, 20220402);
              LiveService.AddLive(&quot;2022年4月10日（日）VELL'z FIRE presents&quot;, 20220410);
              LiveService.AddLive(&quot;2022年4月10日（日）ILLUSION FORCE presents「ILLUSION FORCE×Amiliyah LONG STAGE 2MAN GIG」&quot;, 20220410);
              LiveService.AddLive(&quot;2022年4月29日（金・祝）渋谷メタル会 presents 渋谷メタル会フェス 2022」&quot;, 20220429);
              var Lists = LiveService.db.Table&lt;Live&gt;().ToList();
              MainListView.ItemsSource = Lists;
              int dateInt = Lists[2];
              DateTime dater = Convert.ToDateTime(dateInt);
              int result = DateTime.Compare(dater, DateTime.Now);
              if (result &lt; 0)
              {
                  Label.TextDecorations = TextDecorations.Strikethrough;
              }
  </code></pre>
  <p>How I created the Table</p>
  <pre><code>namespace IF2.Models
  {
      public class Live
      {
  
      public string Name { get; set; }
       public string Date { get; set; }
      public string Place { get; set; }
          public string Time { get; set; }
  
  
      }
  
  }
  </code></pre>
  <p>Service File</p>
  <pre><code>public static SQLiteConnection db;
  
          static void Init()
          {
              
              if (db != null)
                  return;
  
              // Get an absolute path to the database file
              var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), &quot;Lives.db3&quot;);
  
              db = new SQLiteConnection(databasePath);
              db.DropTable&lt;Live&gt;();
              db.CreateTable&lt;Live&gt;();
          }
  
          public static void AddLive(string name, string date)
          {
              Init();
           
              var live = new Live
              {
                  Name = name,
                  Date = date,
                  
              };
  
              var id = db.Insert(live);
          }
          public static void GetProperties()
          {
              Init();
              var Lists = db.Table&lt;Live&gt;().ToList();
          }
  
  
  
  
      }
  }
  </code></pre>