Java Program to parse Time using custom format

Samual Sam
Updated on 27-Jun-2020 09:30:10
To get the time format, use the DateFormat class and create a new object.DateFormat dateFormatter = new SimpleDateFormat("hh.mm.ss a");Now, parse the time.dateFormatter.parse("12.55.20 PM");Example Live Demoimport java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main {    public static void main(String[] argv) throws Exception {       DateFormat dateFormatter = new SimpleDateFormat("hh.mm.ss a");       System.out.println("Parse Time...");       Date dt = (Date) dateFormatter.parse("12.55.20 PM");       System.out.println(dt);    } }OutputParse Time... Thu Jan 01 12:55:20 UTC 1970

Parse string date value input in Java

karthikeya Boyini
Updated on 27-Jun-2020 09:29:14
UseSimpleDateFormat('dd-MMM-yy') for string date.Format dateFormatter = new SimpleDateFormat("dd-MMM-yy");For above class, do not forget to import the following package, else an error would be visible.import java.text.SimpleDateFormat;Now, parse the date.Date dt = (Date) dateFormatter.parseObject("20-Nov-18");Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; public class Main {    public static void main(String[] argv) throws Exception {       Format dateFormatter = new SimpleDateFormat("dd-MMM-yy");       // parse       Date dt = (Date) dateFormatter.parseObject("20-Nov-18");       System.out.println("Date = "+dt);    } }OutputDate = Tue Nov 20 00:00:00 UTC 2018

What are sitemaps? How to create them?

Prasanna Kotamraju
Updated on 27-Jun-2020 09:27:28
A sitemap is the map of a website showing the location of pages. These sitemaps are formatted for Search Engine Optimization and to streamline the user experience.There are different types of sitemaps. They can be Standard sitemaps, Content-based such as videos, images etc., How to Create a SitemapThere are a lot of plugins available that automatically create a sitemap. People who use WordPress can create a sitemap with a few simple clicks. For simple websites, these plugins work fine.There are very good options for SEO for WordPress by Yoast, which has a built-in sitemap generator, or Google XML Sitemaps Generator ... Read More

What are some free domain name suggester tools?

Prasanna Kotamraju
Updated on 27-Jun-2020 09:26:43
A domain name should be catchy and memorable and yet meaningful at the same time. It is not an easy task to set a perfect name for your domain. You may feel that you’ve come up with something catchy and worthy of your brand and to your dismay, you may find that the .com domain is already taken.To avoid all this headache and hairpulling let us take the help of some of the free domain suggester tools.Lean Domain SearchBust a NameShopify Business Name GeneratorNameboyNameStallDomain PuzzlerName MeshDomains BotPanabeeName StationImpossibility!Instant Domain SearchI Want My NameDot-o-MatorCool Name IdeasDomainWheel

Microprocessor Basics

Chandu yadav
Updated on 27-Jun-2020 09:24:10
The processor on a single chip is called a Microprocessor which can process micro-instructions. Instructions in the form of 0s and 1s are called micro-instructions. The microprocessor is the CPU part of a microcomputer, and it is also available as a single integrated circuit. Thus as main components, the microprocessor will have the Control Unit (CU) and the Arithmetic Logic Unit (ALU) of a microcomputer. An example is Intel 8085 microprocessor. In addition to the microprocessor features, a microcomputer will have the following additional features −ROM / PROM / EPROM / EEPROM for storing programRAM for storing data, intermediate results, ... Read More

Gregorian Calendar in Java

Samual Sam
Updated on 27-Jun-2020 09:13:00
GregorianCalendar is a hybrid calendar that supports both the Julian and Gregorian calendar systems with the support of a single discontinuity, which corresponds by default to the Gregorian date when the Gregorian calendar was instituted.The java.util.GregorianCalendar class in Java is a concrete subclass of Calendar and provides the standard calendar system used by most of the world.Import the following package to work with GregorianCalendar class.import java.util.GregorianCalendar;The following are the constructors.Sr.No.Constructor & Description1GregorianCalendar() This constructs a default GregorianCalendar using the current time in the default time zone with the default locale.2GregorianCalendar(int year, int month, int dayOfMonth) This constructs a GregorianCalendar with the given ... Read More

Why are women smarter than men?

Prasanna Kotamraju
Updated on 27-Jun-2020 09:10:27
"Women who seek to be equal with men lack ambition." - Timothy LearyWhen we compare intelligence and gender, decades of research proves that men and women are equal in general intelligence (IQ).When it comes to judging on emotions, gender is the common criteria for people to assign labels to emotion. General statements such as women are overly emotional, and men are aloof from emotions are heard all the time.As per Forbes, the TalentSmart has tested the emotional intelligence of more than a million people and it's clear that women have the upper hand. Women's overall EQ score was a couple ... Read More

Does the Bardo of “Tibetan Book of The Dead” and the “Garuda Purana” of Hindus talk about the same thing?

Prasanna Kotamraju
Updated on 27-Jun-2020 09:09:13
The Tibetan Book of the Dead ( Bardo Thodol ) was a set of seven texts which visualizes the after-death experiences. It was written by Padma Sambhava and deals with matters concerning death and describes the afterlife.Tibetan Buddhists believe in six Bardo States which detail what happens through life death and rebirth. This book discusses the experiences one has after death, in the Bardo, the interval between death and the next rebirth. The text also includes chapters on the signs of death and rituals to undertake when death is closing in or has taken place.Garuda Purana is one of 18 ... Read More

Specify the TimeZone explicitly for Gregorian Calendar in Java

karthikeya Boyini
Updated on 27-Jun-2020 09:08:31
To specify the TimeZone explicitly, use the getTimeZone() method of the TimeZone class. For Locale and TimeZone, we have imported the following packages.import java.util.Locale; import java.util.TimeZoneLet us specify for timezone America/New_York.GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("America/New_York"), Locale.US);The following is an example.Example Live Demoimport java.util.GregorianCalendar; import java.util.Locale; import java.util.TimeZone; public class Demo {    public static void main(String[] a) {       GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("America/New_York"), Locale.US);       System.out.println(cal);    } }Outputjava.util.GregorianCalendar[time=1542643323673, areFieldsSet=true, areAllFieldsSet=true, lenient=true, zone=sun.util.calendar.ZoneInfo[id="America/New_York", offset=-18000000, dstSavings=3600000, useDaylight=true, transitions=235, lastRule=java.util.SimpleTimeZone[id=America/New_York, offset=-18000000, dstSavings=3600000, useDaylight=true, startYear=0, startMode=3, startMonth=2, startDay=8, startDayOfWeek=1, startRead More

Why it is important to sleep at noon?

Prasanna Kotamraju
Updated on 27-Jun-2020 09:07:48
Many people fear that sleeping in the afternoon helps to gain weight. Well, good news for people who feel sleepy in the afternoon. Many surprising benefits are identified with an afternoon nap.A small nap in the afternoon can bring complete refreshment for you. People, who can take a short but peaceful sleep, can be rewarded with enough benefits. Scientific research has proved that daytime nap is very much beneficial. Taking a nap during daytime is good for people who do not get sufficient sleep at night time.Watch out ... If you are in depression and cannot sleep in the night, ... Read More
Advertisements