ZonedDateTimeplusMinutes() method in Java, example

ZonedDateTime plusMinutes() method in Java, examples Original text: https://www . geeksforgeeks . org/zoneddatetime-plusminutes-method-in-Java-with-examples/ plusMinutes() A method of the ZonedDateTime class, used to add minutes to this ZonedDateTime and return a ZonedDateTime after adding copy. The method operates on the immediate timeline, so adding a minute will always be the duration one minute later. This instance is immutable and is not affected by calls to this method. Syntax: public ZonedDateTime plusMinutes(long minutes) Parameters:This method accepts The single parameter minutes represents the number of minutes to be added and can be a negative number. Return value: This method returns a regional time based on the date and time plus minutes, which is not empty. Exception: This method throws a DateTimeException if the result is outside the supported date range. The following program illustrates the plusMinutes() method:Program 1: // Java program to demonstrate// ZonedDateTime.plusMinutes() methodimport java.time.*;public class GFG {  public static void main(String[] args) { // create a ZonedDateTime object ZonedDateTime zoneddatetime                                                      ZonedDateTime.parse(                                                    =”s”>”2018-12-06T19:21:12.123+05:30[Asia/Calcutta]”); // print instance System.out .println(“ZonedDateTime before”                                                                                                                               o”>+ zoneddatetime); // add 3 minutes ZonedDateTime returnvalue   = zoneddatetime.plusMinutes(3); // print result System.out.println(“ZonedDateTime after ”                                        class=”o”>+ ” adding minutes: ”                                      “>returnvalue); }} Output: Region added time minutes ago: 2018-12-06T19: 21:12.123+05:30【Asia/Kolkata】Region addition time after adding minutes: 2018-12-06T19:24:12.123+05:30【Asia/Kolkata】 Program 2: // Java program to…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: 34331943@QQ.com

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索