Get Number of Quarters Between Two Dates in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

648 Views

Let’s say we have the following two dates −LocalDate.of(2019, 3, 20); LocalDate.of(2019, 10, 25);To get the number of quarters between the above two dates, use the QUARTER_YEARS −IsoFields.QUARTER_YEARS.between(LocalDate.of(2019, 3, 20),LocalDate.of(2019, 10, 25));Exampleimport java.time.LocalDate; import java.time.temporal.IsoFields; public class Demo {    public static void main(String[] args) {       long quarters =          IsoFields.QUARTER_YEARS.between(LocalDate.of(2019, 3, 20), LocalDate.of(2019, 10, 25));       System.out.println("Quarters between the two dates = " + quarters);    } }OutputQuarters between the two dates = 2

Remove Null Element from MongoDB Array

Samual Sam
Updated on 30-Jul-2019 22:30:25

1K+ Views

You can use $pull operator for this. Let us first create a collection with documents −> db.removeNullDemo.insertOne( ... { ...    "_id" : 1, ...    "StudentDetails" : [ ...       { ...          "FirstName": "John", ...          "LastName":"Smith", ... ...       }, ...       { ...          "Age":21 ...       }, ...       null ... ...    ] ... } ... ); { "acknowledged" : true, "insertedId" : 1 } > db.removeNullDemo.insertOne( ... { ...    "_id" : 2, ... ... Read More

Reasons That Could Make Your Training a Flop

Anuradha Nanda
Updated on 30-Jul-2019 22:30:25

195 Views

You have attended a great training session, which was very interactive and all the participants enjoyed the session. Even the trainer was very good, but still, there was not a great outcome from it. What could be the reason?It may be because Service / Customer Satisfaction Scores Are Poor. In other words, you might not have scheduled enough employees to handle responsibilities, like the lunchtime rush, or the cashier stations, or parking during a busy holiday week. There could be many other reasons too:Irrelevant Topics Discussed: We need to evaluate the training properly. Maybe the topic of the training was not ... Read More

Why is the Term Bachelor Used in Educational Qualifications

Suman Nanda
Updated on 30-Jul-2019 22:30:25

313 Views

A college degree (from Middle Asian baccalaureus) or baccalaureate (from Modern Latin baccalaureates) is an undergraduate academic level awarded by universities and colleges after completion of training lasting three to several years (depending on the organization and academic discipline).Origin of the TermThe definition of bachelor in the twelfth century referred to a knight bachelor, who was too young or poor to gather vassals under his own banner. By simply the end of the 13th century, it was also employed by junior associates of guilds or schools. By folk etymology or wordplay, the word baccalaureus was associated with bacca Laurie ("laurel berry")It was ... Read More

Rotation of Stepper Motor in Forward and Reverse Directions

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

3K+ Views

Let us consider ALS-NIFC-01, which is a stepper motor interface. Using 26-core flat cable, it is connected to ALS kit. It will be used for interfacing two stepper motors. In our current experiment, we use only one stepper motor. The motor has a step size of 1.8°. The stepper motor works on a power supply of +12V. Power supply of +5V (white wire), GND (black), and +12V (red) is provided to the interface. Note that -12V supply is not used by the interface. We shall have to make sure that the +12V supply has adequate current rating to drive the ... Read More

Add Multiple Copies in ArrayList for ListView in Android

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

183 Views

This example demonstrates How to add multiple copies in arrylist for Listview in Android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/ activity_main.xml.                         In the above code, we have taken name and record number as Edit text, when user click on save button it will store the data into arraylist. Click on ... Read More

MySQL Operator for Multiple NOT Conditions

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

551 Views

Yes, for this MySQL comes with a NOT IN.The syntax is as followsSELECT *FROM yourTableName WHERE yourColumnName NOT IN(1, 2, 7);To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table User_informations    - > (    - > UserId int,    - > UserName varchar(20)    - > ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into User_informations values(12, 'Maxwell'); Query OK, 1 row affected (0.17 sec) mysql> insert into User_informations values(7, 'David'); Query OK, 1 ... Read More

What Are Cookies in JSP

Samual Sam
Updated on 30-Jul-2019 22:30:25

329 Views

Cookies are text files stored on the client computer and they are kept for various information tracking purposes. JSP transparently supports HTTP cookies using underlying servlet technology.There are three steps involved in identifying and returning users -Server script sends a set of cookies to the browser. For example, name, age, or identification number, etc.Browser stores this information on the local machine for future use.When the next time the browser sends any request to the web server then it sends those cookies information to the server and server uses that information to identify the user or may be for some other ... Read More

Use lastIndexOf in Android TextView

Anvi Jain
Updated on 30-Jul-2019 22:30:25

346 Views

This example demonstrate about How to use lastIndexOf () in Android textview.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.             In the above code, we have taken name as Edit text, when user click on button it will take data and returns last index of “sai”.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; ... Read More

IntStream noneMatch Method in Java

Ankith Reddy
Updated on 30-Jul-2019 22:30:25

752 Views

The noneMatch() method in Java returns whether no elements of this stream match the provided predicate. The true boolean value is returned if either no elements of the stream match the provided predicate or the stream is empty.The syntax is as followsBoolean noneMatch(IntPredicate predicate)Here, parameter predicate is the stateless predicate to apply to elements of this streamCreate an IntStreamIntStream intStream = IntStream.of(15, 25, 50, 60, 80, 100, 130, 150);Here, set a condition that returns whether no elements of this stream match the provided predicate. We are checking for none of the value less than 10boolean res = intStream.noneMatch(a -> a ... Read More

Advertisements