- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Karthikeya Boyini has Published 2383 Articles
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
12K+ Views
With JSP program, it is very easy to get the current date and the time. You can use a simple Date object with the toString() method to print the current date and the time as follows −Example Live Demo Display Current Date & Time ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
141 Views
To create custom DateTime formatter, use DateTimeFormatter. Let us first see for Time −DateTimeFormatter dtFormat = new DateTimeFormatterBuilder() .appendValue(ChronoField.HOUR_OF_DAY) .appendLiteral(":") .appendValue(ChronoField.MINUTE_OF_HOUR) .appendLiteral(":") .appendValue(ChronoField.SECOND_OF_MINUTE) .toFormatter();For Date −dtFormat = new DateTimeFormatterBuilder() .appendValue(ChronoField.YEAR) .appendLiteral("/") .appendValue(ChronoField.MONTH_OF_YEAR) .appendLiteral("/") .appendValue(ChronoField.DAY_OF_MONTH) .toFormatter();Exampleimport java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.temporal.ChronoField; public class Demo { public static void ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
90 Views
Let us first create a collection with documents −> db.likeDemo.insertOne({"Name":"John", Age:32}); { "acknowledged" : true, "insertedId" : ObjectId("5cb84984623186894665ae41") } > db.likeDemo.insertOne({"Name":"Chris", Age:25}); { "acknowledged" : true, "insertedId" : ObjectId("5cb84991623186894665ae42") } > db.likeDemo.insertOne({"Name":"Carol", Age:22}); { "acknowledged" : true, "insertedId" : ObjectId("5cb849a1623186894665ae43") } > db.likeDemo.insertOne({"Name":"Johnny", Age:22}); ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
3K+ Views
You can use ORDER BY ASC to order timestamp values in ascending order with TIMESTAMP() method.The following is the syntax using TIMESTAMP() −SELECT timestamp( yourTimestampColumnName ) as anyAliasName From yourTableName order by 1 ASCTo understand the above syntax, let us create a table. The query to create a table is ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
57 Views
To create a tuple from another collection, you need to use fromCollection() method.Let us first see what we need to work with JavaTuples. To work with Quintet class in JavaTuples, you need to import the following package −import org.javatuples.Quintet;Note − Steps to download and run JavaTuples program If you are ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
68 Views
It can be checked if the duration is of zero length or not using the isZero() method in the Duration class in Java. This method requires no parameters. Also, it returns true if the duration is of zero length and false otherwise.A program that demonstrates this is given as follows ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
497 Views
The CachedRowSet is the base implementation of disconnected row sets. It connects to the data source, reads data from it, disconnects with the data source and the processes the retrieved data, reconnects to the data source and writes the modifications.Creating a CachedRowSetYou can create a Cached RowSet object using the ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
594 Views
You can use aggregate framework along with $month projection operator. Let us first create a collection with documents −> db.specificMonthDemo.insertOne({"StudentName":"Larry", "StudentDateOfBirth":new ISODate('1995-01-12')}); { "acknowledged" : true, "insertedId" : ObjectId("5cb9a9ca8f1d1b97daf71819") } > db.specificMonthDemo.insertOne({"StudentName":"Chris", "StudentDateOfBirth":new ISODate('1999-12-31')}); { "acknowledged" : true, "insertedId" : ObjectId("5cb9a9db8f1d1b97daf7181a") } > db.specificMonthDemo.insertOne({"StudentName":"David", "StudentDateOfBirth":new ISODate('2000-06-01')}); ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
231 Views
The equality of two durations can be determined using the equals() method in the Duration class in Java. This method requires a single parameter i.e. the duration to be compared. Also, it returns true if both the durations are equal and false otherwise.A program that demonstrates this is given as ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
55 Views
The contain() method is used to search a value in Septet class.Let us first see what we need to work with JavaTuples. To work with Septet class in JavaTuples, you need to import the following package −import org.javatuples.Septet;Note − Steps to download and run JavaTuples program If you are using ... Read More