title: Checking if LocalDateTIme is null in a conditional
body: <p>Here I have a function that formats a string to a LocalDateTime and returns it.</p>
  
  <pre><code>val dateSentFormatted = timeFormatted(record.data.dateTime);
  </code></pre>
  
  <pre><code>private fun timeFormatted(dateEmailSent: String?): LocalDateTime {
      val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd:HH:mm:ss");
      return LocalDateTime.parse(dateEmailSent, formatter);
  }
  </code></pre>
  
  <p>My question is I wanted an if statement to run on it elsewhere in my file to check whether it's null as in:</p>
  
  <pre><code>if (!dateSentFormatted != null ) {
  
  }
  </code></pre>
  
  <p>But it doesn't like that, how else can I check whether a variable of type LocalDateTime is empty in an if statement?</p>