How to compare the data from the same sensor at different time?
Write down readings with the current time, then later look back at your notes and see how the readings compare.
You need to provide more information. Do you mean code that compares the two different readings? Are you talking about storing a sensor reading even when the Arduino has no power?