String to Date Object Example in java

This example shows you how to parse the String date object in Java Date object using SimpleDateFormat object. package com.java.connect.date; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class StringToDateObjectExample { public static void main(String[] args) throws ParseException { // A string of date with time String dateWithtimeString = “08-05-2011 15:30:18″; // Create an instance of […]

Continue reading


SimpleDateFormat Year Example in java

This example shows you how to get the Current year from a java date object using SimpleDateFormat object. package com.java.connect.date; import java.text.SimpleDateFormat; import java.util.Calendar; public class SimpleDateFormatYearExample { public static void main(String[] args) { // Get the simple date format object by passing the format in string SimpleDateFormat format = new SimpleDateFormat(“yyyy”); // get the […]

Continue reading


SimpleDateFormat with Time Example in java

This example shows you how to get the Java date object in String format of “dd-MM-yyyy hh:mm:ss” using SimpleDateFormat object. package com.java.connect.date; import java.text.SimpleDateFormat; import java.util.Calendar; public class SimpleDateFormatWithTime { public static void main(String[] args) { // Get the simple date format object by passing the format in string SimpleDateFormat format = new SimpleDateFormat(“dd-MM-yyyy hh:mm:ss”); […]

Continue reading


SimpleDateFormat Weak in Year Example in java

This example shows you how to get current week of the year using SimpleDateFormat object. package com.java.connect.date; import java.text.SimpleDateFormat; import java.util.Calendar; public class SimpleDateFormatWeakInYearExample { public static void main(String[] args) { // Get the simple date format object by passing the format in string SimpleDateFormat format = new SimpleDateFormat(“ww”); // get the date in String […]

Continue reading


SimpleDateFormat Second in Minute Example in java

This example shows you how to get the Current date with seconds in minute using SimpleDateFormat object. package com.java.connect.date; import java.text.SimpleDateFormat; import java.util.Calendar; public class SimpleDateFormatSecondInMinuteExample { public static void main(String[] args) { // Get the simple date format object by passing the format in string SimpleDateFormat format = new SimpleDateFormat(“dd-MM-yyyy hh:mm:ss”); // get the […]

Continue reading


SimpleDateFormat RFC 822 Time Zone Example in java

This example shows you how to get the PFC 822 time zone of java date using SimpleDateFormat object. package com.java.connect.date; import java.text.SimpleDateFormat; import java.util.Calendar; public class SimpleDateFormatRFC822TimeZoneExample { public static void main(String[] args) { // Get the simple date format object by passing the format in string SimpleDateFormat format = new SimpleDateFormat(“ZZZZZ”); // get the […]

Continue reading


SimpleDateFormat Month in Year Example in java

This example shows you how to get the java date in format with month in year using SimpleDateFormat object. package com.java.connect.date; import java.text.SimpleDateFormat; import java.util.Calendar; public class SimpleDateFormatMonthInYearExample { public static void main(String[] args) { // Get the simple date format object by passing the format in string SimpleDateFormat format = new SimpleDateFormat(“MMM”); // get […]

Continue reading


SimpleDateFormat Minute in Hour Example in java

This example show you how to get the java Date with format of minutes in hours using SimpleDateFormat object. package com.java.connect.date; import java.text.SimpleDateFormat; import java.util.Calendar; public class SimpleDateFormatMinuteInHourExample { public static void main(String[] args) { // Get the simple date format object by passing the format in string SimpleDateFormat format = new SimpleDateFormat(“dd-MM-yyyy hh:mm”); // […]

Continue reading


SimpleDateFormat Millisecond Example in java

This example shows you how to get the milliseconds in current time using SimpleDateFormat object. package com.java.connect.date; import java.text.SimpleDateFormat; import java.util.Calendar; public class SimpleDateFormatMillisecondExample { public static void main(String[] args) { // Get the simple date format object by passing the format in string SimpleDateFormat format = new SimpleDateFormat(“SSS”); // get the date in String […]

Continue reading