Karthikeya Boyini has Published 2383 Articles

Wave effect with CSS?

karthikeya Boyini

karthikeya Boyini

Updated on 27-Jun-2020 12:22:47

2K+ Views

Wave effect is used to give the object a sine wave distortion to make it look wavy.The following parameters can be used in this filter:S.NoParameter & Description1.AddA value of 1 adds the original image to the waved image, 0 does not.2.FreqThe number of waves.3.LightThe strength of the light on the ... Read More

Set a GregorianCalendar object to a particular date in Java

karthikeya Boyini

karthikeya Boyini

Updated on 27-Jun-2020 09:37:21

301 Views

To work with the GregorianCalendar class, import the following package.import java.util.GregorianCalendar;Firstly, create a GregorianCalendar object.GregorianCalendar calendar = new GregorianCalendar();Now, set the above-created object to a date. Here 0 is for 1st month.calendar.set(2018, 0, 25);The following is an example.Example Live Demoimport java.util.GregorianCalendar; import java.util.Calendar; import java.util.Date; public class Demo {    public ... Read More

Modify Date and Time from GregorianCalendar in Java

karthikeya Boyini

karthikeya Boyini

Updated on 27-Jun-2020 09:33:19

687 Views

For GregorianCalendar class, import the following package.import java.util.GregorianCalendar;Firstly, let us display the current date and time.GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); System.out.println("Current date: " + cal.getTime());Now, modify the date. Here we are adding two days to the month using the add() method.cal.add((GregorianCalendar.MONTH), 2);Example Live Demoimport java.util.Calendar; import java.util.GregorianCalendar; public class Demo { ... Read More

Java Program to display past date from GregorianCalendar

karthikeya Boyini

karthikeya Boyini

Updated on 27-Jun-2020 09:31:24

251 Views

For GregorianCalendar class, import the following package.import java.util.GregorianCalendar;Here is the object.GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance();Now, let us get the past date, using the add() method with a negative value.// past date cal.add((GregorianCalendar.DATE), -1);Example Live Demoimport java.util.Calendar; import java.util.GregorianCalendar; public class Demo {    public static void main(String[] a) {     ... Read More

Parse string date value input in Java

karthikeya Boyini

karthikeya Boyini

Updated on 27-Jun-2020 09:29:14

147 Views

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 ... Read More

Specify the TimeZone explicitly for Gregorian Calendar in Java

karthikeya Boyini

karthikeya Boyini

Updated on 27-Jun-2020 09:08:31

145 Views

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 { ... Read More

Display entire date time with milliseconds in Java

karthikeya Boyini

karthikeya Boyini

Updated on 27-Jun-2020 09:03:28

218 Views

Import the following package to work with Calendar class in Java, import java.util.Calendar;To display the entire day time, firstly create a Calendar object.Calendar cal = Calendar.getInstance();Display the entire date time using the fields shown below −// DATE Calendar.YEAR Calendar.MONTH Calendar.DATE // TIME Calendar.HOUR_OF_DAY Calendar.HOUR Calendar.MINUTE Calendar.SECOND Calendar.MILLISECONDThe following is the ... Read More

Get week of month and year using Java Calendar

karthikeya Boyini

karthikeya Boyini

Updated on 27-Jun-2020 09:01:18

1K+ Views

For using Calendar class, import the following package.import java.util.Calendar;Create a Calendar class object.Calendar cal = Calendar.getInstance();Now, get the week of month and year using the following fields.Calendar.WEEK_OF_MONTH Calendar.WEEK_OF_YEARThe following is an example.Example Live Demoimport java.util.Calendar; public class Demo {    public static void main(String[] args) {       Calendar cal ... Read More

Checking for a Leap Year using GregorianCalendar in Java

karthikeya Boyini

karthikeya Boyini

Updated on 27-Jun-2020 08:58:28

274 Views

The GregorianCalendar.isLeapYear() method determines if the given year is a leap year. Returns true if the given year is a leap year.Firstly, import the following package to work with GregorianCalendar class.import java.util.GregorianCalendar;Now, check for a year by adding it as a parameter in the isLeapYear() method.gcal.isLeapYear(2012)The following is an example.Example Live ... Read More

Get Day Number of Week in Java

karthikeya Boyini

karthikeya Boyini

Updated on 27-Jun-2020 08:57:07

10K+ Views

To get the day of the week, use Calendar.DAY_OF_WEEK.Firstly, declare a calendar object and get the current date and time.Calendar calendar = Calendar.getInstance(); System.out.println(calendar.getTime().toString());Now, fetch the day of the week in an integer variable.int day = calendar.get(Calendar.DAY_OF_WEEK);The following is the final example.Example Live Demoimport java.util.Calendar; public class Demo {    public ... Read More

Advertisements