Friday 13 January 2012

How to get current Date Timestamps in Java on GMT or Local Timezone Example

Getting current data and timestamps in java is requirement for most of java enterprise application. Formatting date in java or parsing date in Java is such a common functionality that you will need it now and than. Though most of programmer look Google for finding current date and timestamps code in Java, its worth to having an idea how you can do that by using java.util.Date class. some time you might need formatted data string say "yyyy-MM--dd:HH:mm:ss". That is also possible by using dateformat in Java. I have touched base on string to date conversion and now in this article we will see that in detail in terms of current date, time-stamp and timezone values. if you are working in global core java application which runs on different timezones you must need to include timezone in your date and timestamp to avoid any confusion.

No comments:

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More