Format LocalDateTime as ISO Week Date Format in Java

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

182 Views

At first, set the date:LocalDateTime dateTime = LocalDateTime.of(2019, Month.SEPTEMBER, 9, 10, 20);Now, format the datetime as ISO_WEEK_DATE format:String str = dateTime.format(DateTimeFormatter.ISO_WEEK_DATE);Exampleimport java.time.LocalDateTime; import java.time.Month; import java.time.format.DateTimeFormatter; public class Demo {    public static void main(String[] args) {       LocalDateTime dateTime = LocalDateTime.of(2019, Month.SEPTEMBER, 9, 10, 20);       System.out.println("DateTime = "+dateTime);       String str = dateTime.format(DateTimeFormatter.ISO_WEEK_DATE);       System.out.println("Formatted date = "+str);    } }OutputDateTime = 2019-09-09T10:20 Formatted date = 2019-W37-1

MySQL Query to Select Column Where Value is One, Two or Three

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

954 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> insert into DemoTable values(102, 'Robert', 33); Query OK, 1 row affected (0.26 sec) mysql> insert into DemoTable values(103, 'David', 25); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values(104, 'Carol', 35); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable values(105, 'Bob', 29); Query OK, ... Read More

DoubleBuffer Slice Method in Java

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

134 Views

A new DoubleBuffer with the content as a shared subsequence of the original DoubleBuffer can be created using the method slice() in the class java.nio.DoubleBuffer. This method returns the new DoubleBuffer that is read-only if the original buffer is read-only and direct if the original buffer is direct.A program that demonstrates this is given as follows −Example Live Demoimport java.nio.*; import java.util.*; public class Demo {    public static void main(String[] args) {       int n = 5;       try {          DoubleBuffer buffer1 = DoubleBuffer.allocate(n);          buffer1.put(4.5D);       ... Read More

What is a Virtual Circuit Identifier (VCID)?

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

4K+ Views

Virtual Circuit Identifier (VCID or VCI) is an identifier or label on any virtual circuit in a computer network that indicates where a data unit has to travel over the network.A virtual circuit (VC) is a technique by which data is transmitted over a packet switched network such that it seems as though there is a dedicated physical link between the source and destination systems.VCID allows the same channel to be used for simultaneous connections. The same VCID may be reused by connections having disjoint paths, allowing the network to support concurrent connections.Establishment of VC and use of VCIDThe following ... Read More

Concur Read-Only ResultSet in JDBC Explained

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

3K+ Views

In general, you will pass this as a value to the createStatement() method as a value of ResultSet Concurrency type.Statement createStatement(int resultSetType, int resultSetConcurrency)This type of result set is not updatable. i.e. once you get a ResultSet object you cannot update its contents.ExampleSuppose, we have a table named Employee in the database with the following contents:+----+---------+--------+----------------+ | Id | Name    | Salary | Location       | +----+---------+--------+----------------+ | 1  | Amit    | 3000   | Hyderabad      | | 2  | Kalyan  | 4000   | Vishakhapatnam | | 3  | Renuka  | 6000   ... Read More

LocalDateTime to LocalTime Method in Java

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

87 Views

The representation of the LocalTime can be obtained using the method toLocalTime() in the LocalDateTime class in Java. This method requires no parameters and it returns the LocalTime 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 {    public static void main(String[] args) {       LocalDateTime ldt = LocalDateTime.parse("2019-02-18T23:15:30");       System.out.println("The LocalDateTime is: " + ldt);       System.out.println("The LocalTime representation is: " + ldt.toLocalTime());    } }OutputThe LocalDateTime is: 2019-02-18T23:15:30 The LocalTime representation is: 23:15:30Now let us understand the above program.First ... Read More

DoubleStream flatMap Method in Java

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

143 Views

The flatMap() method of the DoubleStream class returns a stream with the results of replacing each element of this stream with the contents of a mapped stream formed by applying the provided mapping function to each element.The syntax is as followsDoubleStream flatMap(DoubleFunction

Create Octet Tuple in Java

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

155 Views

An Octetclass is a Tuple of 8 element. It is in the JavaTuples library. Let us first see what we need to work with JavaTuples. To work with Octet class in JavaTuples, you need to import the following package.import org.javatuples.Octet;Note: Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide for all the steps to run JavaTuples.Steps: How to run JavaTuples program in EclipseThe following is an example to create Octet ... Read More

Use removeLast in Android LinkedBlockingDeque

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

113 Views

Before getting into an example, we should know what LinkedBlockingDeque is. It is implemented by Collection interface and the AbstractQueue class. It provides optional boundaries based on linked nodes. It going to pass memory size to the constructor and helps to provide memory wastage in android.This example demonstrates about How to use removeLast() in android LinkedBlockingDequeStep 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 a ... Read More

Update Multiple Rows in a Single Column in MySQL

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

3K+ Views

To update multiple rows in a single column, use CASE statement. Let us first create a table −mysql> create table updateMultipleRowsDemo    -> (    -> StudentId int,    -> StudentMathScore int    -> ); Query OK, 0 rows affected (0.63 sec)Following is the query to insert records in the table using insert command −mysql> insert into updateMultipleRowsDemo values(10001, 67); Query OK, 1 row affected (0.14 sec) mysql> insert into updateMultipleRowsDemo values(10002, 69); Query OK, 1 row affected (0.15 sec) mysql> insert into updateMultipleRowsDemo values(10003, 89); Query OK, 1 row affected (0.14 sec) mysql> insert into updateMultipleRowsDemo values(10004, 99); Query ... Read More

Advertisements