Unix time is defined as the number of seconds that have elapsed since midnight Coordinated Universal Time (UTC), 1 January 1970,not counting leap seconds. It is used widely in Unix-like and many other operating systems and file formats. It is neither a linear representation of time nor a true representation of UTC. Unix time may be checked on some Unix systems by typing date +%s on the command line.
Sometimes it's a bit difficult to compare times stored in different applications or systems with different formats. For example, if we want to compare a DATE in Oracle with a date string in Unix, we need to convert them into a common time type so that they can be compares easily. The common way is we can convert them to UNIX timestamp and then compare which one is larger.
Now we will show how to convert time to UNIX timestamp.
In Oracle, if we have a DATE type, we can convert it into UNIX timestamp using following.
TO_NUMBER(date-TO_DATE(''01-Jan-1970 00:00:00', 'DD-Mon-YYYY HH24:MI:SS'))*24*60*60
In UNIX, if we have date string like "2013-01-19 23:02:01", then we can convert it into UNIX timestamp using
date --date="2013-01-19 23:02:01" +%s
If you want to get the last modified time of a file in UNIX timestamp format, you can use:
stat -c %Y filename
Hope this can help you when you want to compare time from different applications or systems.