- 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
Samual Sam has Published 2492 Articles
Samual Sam
719 Views
Here are the two timezones −ZoneId zone1 = ZoneId.of("America/Panama"); ZoneId zone2 = ZoneId.of("Asia/Taipei");Set the date −LocalDateTime dateTime = LocalDateTime.of(2019, 04, 11, 10, 5);Now, set the first timezone −ZonedDateTime panamaDateTime = ZonedDateTime.of(dateTime, zone1);Set the second timezone −ZonedDateTime taipeiDateTime = panamaDateTime.withZoneSameInstant(zone2);Get the timezone differences in seconds −taipeiDateTime.getOffset().getTotalSeconds()Exampleimport java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; ... Read More
Samual Sam
153 Views
To add a value to the top of an array in MongoDB, you can use unshift() −yourArrayName.unshift("yourValue");The above syntax will add the value to the top of an array in MongoDB. Let us first create an array of strings −> technicalSkills=["Java", "MySQL", "C", "SQL SERVER", "ORACLE", "PL/SQL"];This will produce the ... Read More
Samual Sam
989 Views
To get the total number of rows when using LIMIT, use the following syntax −select SQL_CALC_FOUND_ROWS * FROM yourTableName LIMIT 0, yourLastValue;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table RowsUsingLimit -> ( ... Read More
Samual Sam
91 Views
The fixed instant on the clock can be obtained using the method fixed() in the Clock Class in Java. This method requires two parameters i.e. the fixed instant and the time zone. Also, it returns the fixed instant on the clock. The fixed() method is normally used for testing purposes.A ... Read More
Samual Sam
208 Views
The iteration in Triplet class works in the same way as Arrays collection.Let us first see what we need to work with JavaTuples. To work with Triplet class in JavaTuples, you need to import the following package −import org.javatuples.Triplet;Note − Steps to download and run JavaTuples program If you are ... Read More
Samual Sam
1K+ Views
SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner. SimpleDateFormat allows you to start by choosing any user-defined patterns for date-time formatting.Let us modify the above example as follows −Example Live Demo Display Current Date & Time ... Read More
Samual Sam
83 Views
The duration can be obtained in a one minute format using the ofMinutes() method in the Duration class in Java. This method requires a single parameter i.e. the number of minutes and it returns the duration in a one minute format. If the capacity of the duration is exceeded, then ... Read More
Samual Sam
483 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.You can create a Cached RowSet object using the createCachedRowSet() method ... Read More
Samual Sam
360 Views
To extract the subarray value in MongoDB, you can use $elemMatch projection operator.Let us first create a collection with documents −> db.extractSubArrayDemo.insertOne( ... { ... _id: 101, ... "clientName":"Larry", ... "ClientDetails": ... [ ... ... Read More
Samual Sam
124 Views
The value of a duration in the form of a number of hours can be obtained using the method toHours() in the Duration class in Java. This method does not require any parameters and it returns the duration in the form of a number of hours.A program that demonstrates this ... Read More