{"id":23537,"date":"2014-04-02T16:00:04","date_gmt":"2014-04-02T13:00:04","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=23537"},"modified":"2014-04-02T10:24:26","modified_gmt":"2014-04-02T07:24:26","slug":"java-8-date-time-api-tutorial-localdatetime","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html","title":{"rendered":"Java 8 Date Time API Tutorial : LocalDateTime"},"content":{"rendered":"<p>This blogpost is a part of tutorial series on Date Time API introduced in Java 8. In this blogpost I will go over some of the methods available in LocalDateTime class.<\/p>\n<p>LocalDateTime is an immutable, thread safe object which represents date-time without a time-zone in the ISO-8601 calendar system, such as\u00a02014-03-30T02:51:21. It is normally represented in year-month-day-hour-minute-second and provides accuracy up to the range of nanoseconds.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<ul>\n<li>For month, the valid value range is 1 &#8211; 28\/31<\/li>\n<li>For hours, the valid value range is 0 \u2013 23.<\/li>\n<li>The valid values for minutes and seconds are in the range 0 \u2013 59.<\/li>\n<li>For nano seconds the valid value range is 0 \u2013 999999999.<\/li>\n<\/ul>\n<p>The LocalDateTime object can be created in a number of ways listed below.<\/p>\n<pre class=\" brush:java wrap-lines:false\">LocalDateTime dateTime = LocalDateTime.now();\/\/returns the system date time in the default timezone.\r\nSystem.out.println(\"dateTime from the system is:\"+dateTime);\r\n\r\n\/\/creates a date time with the values provided as parameters in the sequence year, month, day of the month, hour of the day, minute of the hour. The second and nano second are set to 0. \r\nLocalDateTime ldtm = LocalDateTime.of(2014, 3, 30, 12, 30);\r\nSystem.out.println(\"dateTime created by passing in year, month,day, hour, minute is:\"+ldtm.toString());\r\n\r\n\/\/creates a date time with the values provided as parameters in the sequence year, month, day of the month, hour of the day, minute of the hour, seconds of the minute. The nano second is set to 0.\r\nLocalDateTime ldts = LocalDateTime.of(2014, 3, 30, 12, 30,23);\r\nSystem.out.println(\"dateTime created by passing in year, month,day, hour, minute, seconds is :\"+ldts.toString());\r\n\r\n\/\/creates a date time with the values provided as parameters in the sequence year, month, day of the month, hour of the day, minute of the hour, seconds of the minute and nano second of the second.\r\nLocalDateTime ldtns = LocalDateTime.of(2014, 3, 30, 12, 30,23,12000);\r\nSystem.out.println(\"dateTime created by passing in year, month,day, hour, minute, seconds, nano seconds is :\"+ldtns.toString());\r\n\r\n\/\/creates a date time with the values provided as parameters in the sequence year, month value from the Month enum, day of the month, hour of the day, minute of the hour. The second and nano second are set to 0.\r\nLocalDateTime ldtem = LocalDateTime.of(2013, Month.APRIL, 1, 12, 30);\r\nSystem.out.println(\"The date time object created by passing in year, month from enum, day, hour , minute is : \"+ldtem.toString());\r\n\r\n\/\/creates a date time with the values provided as parameters in the sequence year, month value from the Month enum, day of the month, hour of the day, minute of the hour, seconds of the minute. The nano second is set to 0.\r\nLocalDateTime ldtes = LocalDateTime.of(2013, Month.APRIL, 1, 12, 30,42);\r\nSystem.out.println(\"The date time object created by passing in year, month from enum, day, hour , minute,second is : \"+ldtes.toString());\r\n\r\n\/\/creates a date time with the values provided as parameters in the sequence year, month value from the Month enum, day of the month, hour of the day, minute of the hour, seconds of the minute and nano seconds of the seconds.\r\nLocalDateTime ldtens = LocalDateTime.of(2013, Month.APRIL, 1, 12, 30,42,12000);\r\nSystem.out.println(\"The date time object created by passing in year, month from enum, day, hour , minute,seconds, ns is : \"+ldtens.toString());<\/pre>\n<p>There are several methods to get the values of the fields like Month, Year, day of week, day of the month, seconds, minutes, nano seconds.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\" brush:java\">int dayOfMonth = dateTime.getDayOfMonth();\/\/returns the day of the month.\r\nSystem.out.println(\"day Of Month is :\"+dayOfMonth);\r\nDayOfWeek dow = dateTime.getDayOfWeek();\/\/returns DayOfWeek enum.\r\nSystem.out.println(\"dow:\"+dow);\r\nint dayOfYear = dateTime.getDayOfYear();\/\/returns the day of the year.\r\nSystem.out.println(\"day Of Year is :\"+dayOfYear);\r\nint hour = dateTime.getHour();\/\/returns hour of the day.\r\nSystem.out.println(\"hour:\"+hour);\r\nint monthValue = dateTime.getMonthValue();\/\/returns the number of the month in the year.\r\nSystem.out.println(\"month of the date in number is:\"+monthValue);\r\nMonth month = dateTime.getMonth();\/\/ returns the month enum for the month of the year.\r\nSystem.out.println(\"month of the date is :\"+month);\r\nint sec = dateTime.getSecond();\/\/ returns seconds field value for the date time.\r\nSystem.out.println(\"Seconds of the date time is:\"+sec);\r\nint nano = dateTime.getNano();();\/\/ returns nano seconds field value for the date time.\r\nSystem.out.println(\"nano seconds of the date time is:\"+nano);\r\nint year = dateTime.getYear();();\/\/ returns year field value for the date time.\r\nSystem.out.println(\"year of the date is :\"+year);<\/pre>\n<p>There are several minusXXX methods which can subtract values for the fields from the date.<\/p>\n<pre class=\" brush:java\">\/\/creates a new date time copy after subtracting 10 days from the date time.\r\nLocalDateTime ldtmd = dateTime.minusDays(10);\r\n System.out.println(\"date time after subtracting days is : \"+ldtmd.toString());\r\n\/\/creates a new date time copy after subtracting 10 hours from the date time.\r\nLocalDateTime ldtmh = dateTime.minusHours(10);\r\nSystem.out.println(\"date time after subtracting hours is : \"+ldtmh.toString());\r\n\/\/creates a new date time copy after subtracting 21 minutes from the date time.\r\nLocalDateTime ldtmm = dateTime.minusMinutes(21);\r\nSystem.out.println(\"date time after subtracting minutes is : \"+ldtmm.toString());\r\n\/\/creates a new date time copy after subtracting 2 months from the date time.\r\nLocalDateTime ldtmmm = dateTime.minusMonths(2);\r\nSystem.out.println(\"date time after subtracting months is : \"+ldtmmm.toString());\r\n\/\/creates a new date time copy after subtracting 3 years from the date time.\r\nLocalDateTime ldtmy = dateTime.minusYears(3);\r\nSystem.out.println(\"date time after subtracting years is : \"+ldtmy.toString());\r\n\/\/creates a new date time copy after subtracting 32 weeks from the date time.\r\nLocalDateTime ldtmw = dateTime.minusWeeks(32);\r\nSystem.out.println(\"date time after subtracting weeks is : \"+ldtmw.toString());\r\n\/\/creates a new date time copy after subtracting 1200 seconds from the date time.\r\nLocalDateTime ldtms = dateTime.minusSeconds(1200);\r\nSystem.out.println(\"date time after subtracting secs is : \"+ldtms.toString());\r\n\/\/creates a new date time copy after subtracting 12000 nano seconds from the date time.\r\nLocalDateTime ldtmn = dateTime.minusNanos(12000);\r\nSystem.out.println(\"date time after subtracting nanos is : \"+ldtmn.toString());<\/pre>\n<p>Similarly there are plusXXX methods which can add the values to the fields of the date time can create LocalDateTime object.<\/p>\n<pre class=\" brush:java\">\/\/creates a new date time copy after adding 10 days to the date time. \r\nLocalDateTime ldtpd = dateTime.plusDays(10);\r\nSystem.out.println(\"date time after adding days is : \"+ldtpd.toString());\r\n\/\/creates a new date time copy after adding 100 hours to the date time. \r\nLocalDateTime ldtph = dateTime.plusHours(100);\r\nSystem.out.println(\"date time after adding hours is : \"+ldtph.toString());\r\n\/\/creates a new date time copy after adding 190 minutes to the date time. \r\nLocalDateTime ldtpmm = dateTime.plusMinutes(190);\r\nSystem.out.println(\"date time after adding minutes is : \"+ldtpmm.toString());\r\n\/\/creates a new date time copy after adding 32 months to the date time. \r\nLocalDateTime ldtpdm = dateTime.plusMonths(32);\r\nSystem.out.println(\"date time after adding months is : \"+ldtpdm.toString());\r\n\/\/creates a new date time copy after adding 120000 nano seconds to the date time. \r\nLocalDateTime ldtpn = dateTime.plusNanos(120000);\r\nSystem.out.println(\"date time after adding nanos is : \"+ldtpn.toString());\r\n\/\/creates a new date time copy after adding 1200 seconds to the date time. \r\nLocalDateTime ldtps = dateTime.plusSeconds(1200);\r\nSystem.out.println(\"date time after adding seconds is : \"+ldtps.toString());\r\n\/\/creates a new date time copy after adding 24 weeks to the date time. \r\nLocalDateTime ldtpw = dateTime.plusWeeks(24);\r\nSystem.out.println(\"date time after adding weeks is : \"+ldtpw.toString());\r\n\/\/creates a new date time copy after adding 3 years to the date time. \r\nLocalDateTime ldtpy = dateTime.plusYears(3);\r\nSystem.out.println(\"date time after adding years is : \"+ldtpy.toString());<\/pre>\n<p>There are several withXXX methods which can set the value to the particular field.<\/p>\n<pre class=\" brush:java wrap-lines:false\">LocalDateTime ldtmddm = dateTime.withDayOfMonth(10); \/\/ sets the day of the month to 10.\r\nSystem.out.println(\"date time after adding modifying day of the month is : \"+ldtmddm.toString());\r\nLocalDateTime ldtmddy = dateTime.withDayOfYear(12);\/\/sets the day of year to 12.\r\nSystem.out.println(\"date time after adding modifying day of the year is : \"+ldtmddy.toString());\r\nLocalDateTime ldtmdh = dateTime.withHour(12);\/\/sets the hour of the day to 12. The other date time fields are not modified.\r\nSystem.out.println(\"date time after adding modifying hour is : \"+ldtmdh.toString());\r\nLocalDateTime ldtmdmm = dateTime.withMinute(12);\/\/sets the minute of the hour to 12. The other date time fields are not modified.\r\nSystem.out.println(\"date time after adding modifying minutes is : \"+ldtmdmm.toString());\r\nLocalDateTime ldtmdm = dateTime.withMonth(4);\/\/sets the month to 4. The other date time fields are not modified.\r\nSystem.out.println(\"date time after adding modifying month is : \"+ldtmdm.toString());\r\nLocalDateTime ldtmdy = dateTime.withYear(2011);\/\/sets the year to 2012. The other date time fields are not modified.\r\nSystem.out.println(\"date time after adding modifying year  is : \"+ldtmdy.toString());\r\nLocalDateTime ldtmds = dateTime.withSecond(12);\/\/sets the seconds of the minute to 12. The other date time fields are not modified.\r\nSystem.out.println(\"date time after adding modifying seconds is : \"+ldtmds.toString());\r\nLocalDateTime ldtmdn = dateTime.withNano(120000);\/\/sets the nano seconds of seconds to 120000. The other date time fields are not modified.\r\nSystem.out.println(\"date time after adding modifying nanos is : \"+ldtmdn.toString());<\/pre>\n<p>If you want to retrieve only the date or time from this date time, then the following methods can do that.<\/p>\n<pre class=\" brush:java wrap-lines:false\">LocalDate ld = dateTime.toLocalDate();\/\/gets the date value(LocalDate) from the date time. A LocalDate with same year, month and day as this LocalDateTime object will be returned.\r\nSystem.out.println(\"The date field from the date time object is : \"+ld.toString());\r\nLocalTime lt = dateTime.toLocalTime();\/\/ gets the time value(LocalTime) from the date time. returns a LocalTime with the same hour, minute, second and nanosecond as this date-time.\r\nSystem.out.println(\"The time field from the date time object is : \"+lt.toString());<\/pre>\n<h2>Conclusion<\/h2>\n<p>LocalDateTime has several options to manipulate the date and time, some of which are described below.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/codingsquare.blogspot.com\/2014\/03\/java-8-date-time-api-tutorial.html\">Java 8 Date Time API Tutorial : LocalDateTime<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/jcg\">JCG partner<\/a> Venkata Kiran at the <a href=\"http:\/\/codingsquare.blogspot.com\/\">Coding square<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This blogpost is a part of tutorial series on Date Time API introduced in Java 8. In this blogpost I will go over some of the methods available in LocalDateTime class. LocalDateTime is an immutable, thread safe object which represents date-time without a time-zone in the ISO-8601 calendar system, such as\u00a02014-03-30T02:51:21. It is normally represented &hellip;<\/p>\n","protected":false},"author":522,"featured_media":148,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[196],"class_list":["post-23537","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core-java","tag-java-8"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java 8 Date Time API Tutorial : LocalDateTime<\/title>\n<meta name=\"description\" content=\"This blogpost is a part of tutorial series on Date Time API introduced in Java 8. In this blogpost I will go over some of the methods available in\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java 8 Date Time API Tutorial : LocalDateTime\" \/>\n<meta property=\"og:description\" content=\"This blogpost is a part of tutorial series on Date Time API introduced in Java 8. In this blogpost I will go over some of the methods available in\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2014-04-02T13:00:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Venkata Kiran\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Venkata Kiran\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html\"},\"author\":{\"name\":\"Venkata Kiran\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/6f3617a6c2ce2cacef7242e51e2a2ad8\"},\"headline\":\"Java 8 Date Time API Tutorial : LocalDateTime\",\"datePublished\":\"2014-04-02T13:00:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html\"},\"wordCount\":256,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"keywords\":[\"Java 8\"],\"articleSection\":[\"Core Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html\",\"name\":\"Java 8 Date Time API Tutorial : LocalDateTime\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"datePublished\":\"2014-04-02T13:00:04+00:00\",\"description\":\"This blogpost is a part of tutorial series on Date Time API introduced in Java 8. In this blogpost I will go over some of the methods available in\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/04\\\/java-8-date-time-api-tutorial-localdatetime.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/core-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Java 8 Date Time API Tutorial : LocalDateTime\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/6f3617a6c2ce2cacef7242e51e2a2ad8\",\"name\":\"Venkata Kiran\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7c7e9c26a3f57bb4c364738033cc45da05ce7c0bf805adaa0d246694451ff002?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7c7e9c26a3f57bb4c364738033cc45da05ce7c0bf805adaa0d246694451ff002?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7c7e9c26a3f57bb4c364738033cc45da05ce7c0bf805adaa0d246694451ff002?s=96&d=mm&r=g\",\"caption\":\"Venkata Kiran\"},\"description\":\"Kiran is a product developer working in medical domain. He worked on creating scalable java batch applications and is currently working on developing cross platform mobile applications. His current interests include automated testing of mobile applications.\",\"sameAs\":[\"http:\\\/\\\/codingsquare.blogspot.in\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/venkata-kiran\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java 8 Date Time API Tutorial : LocalDateTime","description":"This blogpost is a part of tutorial series on Date Time API introduced in Java 8. In this blogpost I will go over some of the methods available in","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html","og_locale":"en_US","og_type":"article","og_title":"Java 8 Date Time API Tutorial : LocalDateTime","og_description":"This blogpost is a part of tutorial series on Date Time API introduced in Java 8. In this blogpost I will go over some of the methods available in","og_url":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2014-04-02T13:00:04+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","type":"image\/jpeg"}],"author":"Venkata Kiran","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Venkata Kiran","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html"},"author":{"name":"Venkata Kiran","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/6f3617a6c2ce2cacef7242e51e2a2ad8"},"headline":"Java 8 Date Time API Tutorial : LocalDateTime","datePublished":"2014-04-02T13:00:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html"},"wordCount":256,"commentCount":2,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","keywords":["Java 8"],"articleSection":["Core Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html","url":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html","name":"Java 8 Date Time API Tutorial : LocalDateTime","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","datePublished":"2014-04-02T13:00:04+00:00","description":"This blogpost is a part of tutorial series on Date Time API introduced in Java 8. In this blogpost I will go over some of the methods available in","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2014\/04\/java-8-date-time-api-tutorial-localdatetime.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/core-java"},{"@type":"ListItem","position":4,"name":"Java 8 Date Time API Tutorial : LocalDateTime"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/6f3617a6c2ce2cacef7242e51e2a2ad8","name":"Venkata Kiran","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7c7e9c26a3f57bb4c364738033cc45da05ce7c0bf805adaa0d246694451ff002?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7c7e9c26a3f57bb4c364738033cc45da05ce7c0bf805adaa0d246694451ff002?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7c7e9c26a3f57bb4c364738033cc45da05ce7c0bf805adaa0d246694451ff002?s=96&d=mm&r=g","caption":"Venkata Kiran"},"description":"Kiran is a product developer working in medical domain. He worked on creating scalable java batch applications and is currently working on developing cross platform mobile applications. His current interests include automated testing of mobile applications.","sameAs":["http:\/\/codingsquare.blogspot.in\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/venkata-kiran"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/23537","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/522"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=23537"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/23537\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/148"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=23537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=23537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=23537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}