How to check that a timestamp is older than a certain number of months?
<p>I am trying to test that a <code>timestamp</code> (a field in my entity) is older than a certain number of months. </p>

<p>My current code is:</p>

<pre><code>if(person.getBirthday().before(Timestamp.valueOf(String.valueOf(LocalDateTime.now().minusMonths(12)){
   //do something
}
</code></pre>

<p>Note: birthday is a <code>timestamp</code> field and <code>LocalDateTime</code> is from: <code>org.joda.time.LocalDateTime</code></p>

<p>The issue is that this code is giving me the <strong>error</strong>:</p>

<pre><code>Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:130)
Caused by: java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
    at java.sql.Timestamp.valueOf(Timestamp.java:202)
</code></pre>

<p>How else can I check that a timestamp is older than a certain number of months?</p>