title: Firebase: Allow access depending on time difference (server-side-time)
body: <p>So I have a database that looks like this:</p>
  
  <pre><code>Posts
  |
  |
  |----post_id_1
       |
       |---post_title = "...."
       |---post_body = "...."
       |---post_time = "ServerValue.TIME_STAMP"
  |
  |----post_id_2
       |.......
       |.......
  </code></pre>
  
  <p><strong>What I want to do:</strong></p>
  
  <p>I want to prevent a user to read a post that is greater than or equal a month from the day that it was posted?</p>
  
  <p><strong>What I tried:</strong></p>
  
  <p>I tried to use this method by android:</p>
  
  <pre><code>//current time of device
  long current_time = System.currentTimeMillis();
  //month in millisecond
  long month = .....;
  
  if(curent_time - post_time &gt;= month){
  
  //this post was there for a month from the time that it was posted.
  
  }
  </code></pre>
  
  <p><strong>Problem:</strong></p>
  
  <p>If I use the above method then if a user was smart enough he/she will change the time of the device to enter a post (when they shouldn't).</p>
  
  <p><strong>Question:</strong></p>
  
  <p>Any stable way of doing this?</p>
  
  <p>Thanks.</p>
  
  <p><strong>NOTE: WITHOUT GETTING THE TIME STAMP FROM THE SERVER.</strong></p>