Parse String Date Value with Default Format in Java

Samual Sam
Updated on 27-Jun-2020 12:43:56

136 Views

For default format, use −DateFormat.getDateInstance(DateFormat.DEFAULT)To parse the string date value, use the parse() methodDate dt = DateFormat.getDateInstance(DateFormat.DEFAULT).parse("Nov 19, 2018");The following is an example −Example Live Demoimport java.text.DateFormat; import java.util.Date; public class Demo {    public static void main(String[] argv) throws Exception {       // parse date       Date dt = DateFormat.getDateInstance(DateFormat.DEFAULT).parse("Nov 19, 2018");       System.out.println("Date: "+dt);    } }OutputDate: Mon Nov 19 00:00:00 UTC 2018

Display Date Time in dd-MMM-yyyy HH:mm:ss ZZZ Format in Java

karthikeya Boyini
Updated on 27-Jun-2020 12:43:18

3K+ Views

Firstly, import the following Java packagesimport java.text.SimpleDateFormat; import java.util.Date;Now, create objectsDate dt = new Date(); SimpleDateFormat dateFormat;Displaying date in the format we want −dateFormat = new SimpleDateFormat("dd MMM yyyy hh:mm:ss zzz");The following is an example −Example Live Demoimport java.text.SimpleDateFormat; import java.util.Date; public class Demo {    public static void main(String args[]) {       Date dt = new Date();       SimpleDateFormat dateFormat;       dateFormat = new SimpleDateFormat("dd MMM yyyy hh:mm:ss zzz");       System.out.println("Date: "+dateFormat.format(dt));    } }OutputDate: 22 Nov 2018 07:53:58 UTC

Error Correcting Codes: Reed-Solomon Codes

Rishi Rathor
Updated on 27-Jun-2020 12:43:09

7K+ Views

Errors and Error Correcting CodesErrors in data occur when bits get corrupted in the data. When bits are transmitted over the computer network, they are subject to get corrupted due to interference and network problems, leading to errors.Error-correcting codes (ECC) are a sequence of numbers generated by specific algorithms for detecting and removing errors in data that has been transmitted over noisy channels. Error correcting codes ascertain the exact number of bits that has been corrupted as well as the location of the corrupted bits, within the limitations in algorithm.ECCs can be broadly categorized into two types, block codes and ... Read More

Interrupt Structure of 8051

Chandu yadav
Updated on 27-Jun-2020 12:42:54

25K+ Views

Now in this section, we will see the interrupt structure of Intel 8051 microcontroller.Interrupts are basically the events that temporarily suspend the main program, pass the control to the external sources and execute their task. It then passes the control to the main program where it had left off.8051 has five interrupts. These interrupts are INT0,  INT1, TO ,T1 , TI/RI. All of the interrupts can be enabled or disabled by using the IE (interrupt enable) register.The interrupt addresses of these interrupts are like below −InterruptAddressINT00003HINT1000BHT00013HT1001BHTI/RI0023HInterrupt Enable (IE)RegisterThis register can be used to enable or disable interrupts programmatically. This register ... Read More

Display Date in E MMM dd yyyy Format in Java

Samual Sam
Updated on 27-Jun-2020 12:42:43

3K+ Views

Firstly, import the following Java packages −import java.text.SimpleDateFormat; import java.util.Date;Now, create objects −Date dt = new Date(); SimpleDateFormat dateFormat;Displaying date in the format we wantdateFormat = new SimpleDateFormat("E MMM dd yyyy");The following is an example −Example Live Demoimport java.text.SimpleDateFormat; import java.util.Date; public class Demo {    public static void main(String args[]) {       Date dt = new Date();       SimpleDateFormat dateFormat;       dateFormat = new SimpleDateFormat("E MMM dd yyyy");       System.out.println("Date: "+dateFormat.format(dt));    } }OutputDate: Thu Nov 22 2018

Error Correcting Codes: Low-Density Parity-Check Codes

Nishtha Thakur
Updated on 27-Jun-2020 12:42:34

3K+ Views

Error Correcting CodesError-correcting codes (ECC) are a sequence of numbers generated by specific algorithms for detecting and removing errors in data that has been transmitted over noisy channels. Error correcting codes ascertain the exact number of bits that has been corrupted and the location of the corrupted bits, within the limitations in algorithm.ECCs can be broadly categorized into two types, block codes and convolution codes. Low - density parity check code (LDPC) is a linear error correcting block code. They are suitable for large block sizes in very noisy channels.LDPC codes were developed by Robert G. Gallager, in his doctoral ... Read More

Interrupt Handling in 8051

Arjun Thakur
Updated on 27-Jun-2020 12:42:22

1K+ Views

As we have seen there are five different interrupts in 8051. These interrupts are INT0, INT1, TO, T1, TI/RI.There are six states in each machine cycle. These states are S1 to S6. All of the interrupts are sampled at the end of state S5 of each machine cycle. When the instruction takes more than one machine cycle, then the samples are polled during the next machine cycle. When an interrupt flag is set at the S5 of the first machine cycle, then the polling cycle will find it. The interrupt system generates LCALL instruction to call appropriate ISS.There are some ... Read More

Set a Duration in Java

karthikeya Boyini
Updated on 27-Jun-2020 12:42:06

167 Views

To set a duration, let us declare two objects of Calendar classCalendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance();Set a time for one of the calendar objectsc2.add(Calendar.HOUR, 9); c2.add(Calendar.MINUTE, 15); c2.add(Calendar.SECOND, 40);Now, find the difference between both the time. One would be the current time and another we declared above −long calcSeconds = (c2.getTimeInMillis() - c1.getTimeInMillis()) / 1000;The following is an example −Example Live Demoimport java.util.Calendar; public class Demo { public static void main(String args[]) {     Calendar c1 = Calendar.getInstance();     Calendar c2 = Calendar.getInstance();     // set hour, minute and second     c2.add(Calendar.HOUR, 9);   ... Read More

Define Location of a Font for Download in CSS

Chandu yadav
Updated on 27-Jun-2020 12:40:12

102 Views

The @font-face rule is used to define the location of a font for download, although this may run into implementation-specific limits.ExampleLet us see an example    

Interfacing 8251 USART with 8085 Microprocessor

Arjun Thakur
Updated on 27-Jun-2020 12:39:48

21K+ Views

The 8251 chip is Universal Synchronous Asynchronous Receiver Transmitter (USART). It acts as a mediator between the microprocessor and peripheral devices. It converts serial data to parallel form and vice versa. This chip is 28 pin DIP.The pin description of 8251A chipPinDescriptionD0 - D7parallel dataC/DControl register or Data buffer selectRDRead ControlWRWrite controlCSChip SelectCLKclock pulseRESETResetTxCTransmitter ClockTxDtransmitted dataRxCReceiver ClockRxDReceiver DataRxRDYReceiver ReadyTxRDYTransmitter ReadyDSRData Set ReadyDTRData Terminal ReadySYNDET/Synchronous Detect/BRKDETDetectBreakRTSRequest to send DataCTSClear to send DataTxEMPTYTransmitter EmptyVccVcc (5V)GNDGround(0V)Now let us see the functional block diagram of the 8251 chip.There are five different sections in this diagram. These sections are as follows −Read/ Write control logicTransmitter ReceiverData Bus ... Read More

Advertisements