How to get the last modified date and time of a file or directory in Java

Sometimes before processing a file, you want to check it's last modified date to avoid processing an old file. Though some programmers prefer to attach date in the file name itself, I don't find it a cleaner approach. For example, suppose you are downloading closing prices of stocks and processing at the start of the day and loading into the database. In order to accidently process an old file, you can check the last modified date before processing and if it's in the acceptable range, you can process the file. You can get the last modified date of a file in Java by using class. This is a class which represents both file and directory in Java. It contains a method called lastModified() which returns the last modified date of the file. This method returns a long millisecond epoch value, which you can convert to more readable dd MM yyyy HH:mm:sss format by using the SimpleDateFormat class of JDK.  In this article, I'll tell you how to get the last modified date of file and directory in Java.

Difference between GETDATE() vs SYSDATETIME() vs GETUTCDATE() in SQL Server

One of the common question on Microsoft SQL Server interview is, what is the difference between GETDATE(), SYSDATETIME(), and GETUTCDATE(). Even though all three SQL Sever function returns the current date time in SQL Server, there are some subtle differences between them. The main difference between GETDATE() and SYSDATETIME() is that GETDATE returns current date and time as DATETIME but SYSDATETIME returns a DATETIME2 value, which is more precise. The difference between GETDATE() and GETUTCDATE() is in timezone, the GETDATE() function return current date and time in the local timezone, the timezone where your database server is running, but GETUTCDATE() return current time and date in UTC (Universal Time Coordinate) or GMT timezone.

Top 2 Books for OCPJP8 Certification - Java 8 1Z0-809, 810, 813 Exam

This is the second part of best books for Java 8 certifications. Since you need to pass two exams, OCAJP8 and OCPJP8 to become a Java SE 8 certified developer, I have shared some of the best OCAJP8 books in the last article. In this article, I will tell you more about the second exam OCPJP8 and suggest best books prepare OCPJP8. This exam is known as professional level exam and it's tougher than the associate level exam. The OCPJP8 stands for Oracle Certified Professional Java Programmer. The exam code for this certification is 1Z0-809. This is if you don't have any prior Java certifications but you can still become a Java SE 8 certified developer by giving upgrade exams e.g. 1Z0-810 if you already passed the OCJPJP7 exam and 1z0-813 if you have passed OCPJP6 exams. The books suggested in this article is primarily for the 1Z0-809 exam but it can also be used for upgrade exams e.g. 1Z0-810 (upgrade from Java SE 7 to Java SE 8) and 1Z0-813 (upgrade from Java SE 6 to Java SE 8) certifications.