Samual Sam has Published 2310 Articles

LocalDateTime parse() method in Java

Samual Sam

Samual Sam

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

207 Views

The LocalDateTime instance can be obtained from a string value using the parse() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the string which is to be parsed. This string cannot be null. Also, it returns the LocalDateTime instance obtained from the string value ... Read More

How to align a column right-adjusted in MySQL?

Samual Sam

Samual Sam

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

2K+ Views

You can use LPAD() from MySQL for this. Let us first create a table −mysql> create table DemoTable (    FullName varchar(100) ); Query OK, 0 rows affected (0.81 sec)Insert records in the table using insert command −mysql> insert into DemoTable values('John Smith'); Query OK, 1 row affected (0.22 sec) ... Read More

LocalDateTime plus() method in Java

Samual Sam

Samual Sam

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

337 Views

An immutable copy of a LocalDateTime where the required duration is added to it can be obtained using the plus() method in the LocalDateTime class in Java. This method requires two parameters i.e. the duration to be added and the TemporalUnit of the duration. Also, it returns the LocalDateTime object ... Read More

Querying average row length in MySQL?

Samual Sam

Samual Sam

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

1K+ Views

You can use INFORMATION_SCHEMA.TABLES and AVG_ROW_LENGTH to query average row length in MySQL −SELECT AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = ‘yourTableName’;Let us first create a table −mysql> create table DemoTable (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentName varchar(100) ); Query OK, 0 rows affected (0.90 sec)Insert ... Read More

DoubleBuffer compareTo() method in Java

Samual Sam

Samual Sam

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

157 Views

A buffer can be compared with another buffer using the method compareTo() in the class java.nio.DoubleBuffer. This method returns a negative integer if the buffer is less than the given buffer, zero if the buffer is equal to the given buffer and a positive integer if the buffer is greater ... Read More

LocalDateTime toString() method in Java

Samual Sam

Samual Sam

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

1K+ Views

The string value of the LocalDateTime object can be obtained using the method toString() in the LocalDateTime class in Java. This method requires no parameters and it returns the string value of the LocalDateTime object.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { ... Read More

MySQL query to select column where value = one or value = two, value = three, etc?

Samual Sam

Samual Sam

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

953 Views

Let us first create a table −mysql> create table DemoTable (    UserId int,    UserName varchar(10),    UserAge int ); Query OK, 0 rows affected (0.73 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(101, 'Chris', 23); Query OK, 1 row affected (0.15 sec) mysql> ... Read More

DoubleBuffer equals() method in Java

Samual Sam

Samual Sam

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

159 Views

The equality of two buffers can be checked using the method equals() in the class java.nio.DoubleBuffer. Two buffers are equal if they have the same type of elements, the same number of elements and the same sequence of elements. The method equals() returns true if the buffers are equal and ... Read More

LocalDateTime toLocalDate() method in Java

Samual Sam

Samual Sam

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

73 Views

The representation of the LocalDate can be obtained using the method toLocalDate() in the LocalDateTime class in Java. This method requires no parameters and it returns the LocalDate value of the LocalDateTime object.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import java.util.*; public class Demo { ... Read More

LocalDateTime withSecond() method in Java

Samual Sam

Samual Sam

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

59 Views

An immutable copy of a LocalDateTime with the seconds altered as required is done using the method withSecond() in the LocalDateTime class in Java. This method requires a single parameter i.e. the second that is to be set in the LocalDateTime and it returns the LocalDateTime with the second altered ... Read More

Advertisements