Samual Sam has Published 2310 Articles

Flip Out X Animation Effect with CSS

Samual Sam

Samual Sam

Updated on 27-Jun-2020 12:16:55

159 Views

To implement Flip Out X Animation effect with CSS, you can try to run the following code −ExampleLive Demo                    .animated {             background-image: url(/css/images/logo.png);             background-repeat: no-repeat;       ... Read More

Java Program to get the day of the week from GregorianCalendar

Samual Sam

Samual Sam

Updated on 27-Jun-2020 09:36:40

430 Views

For GregorianCalendar class, import the following package.import java.util.GregorianCalendar;Create an object.GregorianCalendar calendar = new GregorianCalendar();To get the day of the week, use the following field.GregorianCalendar.DAY_OF_WEEKThe following is an example.Example Live Demoimport java.util.Calendar; import java.util.GregorianCalendar; public class Demo {    public static void main(String[] a) {       GregorianCalendar calendar = new ... Read More

Java Program to display previous year from GregorianCalendar

Samual Sam

Samual Sam

Updated on 27-Jun-2020 09:32:26

170 Views

For GregorianCalendar class, import the following package.import java.util.GregorianCalendar;Create an object.GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance();Now, use the following field and add() method with a negative one (-1) to display the previous year.cal.add((GregorianCalendar.YEAR), -1)Example Live Demoimport java.util.Calendar; import java.util.GregorianCalendar; public class Demo {    public static void main(String[] a) {       ... Read More

Java Program to parse Time using custom format

Samual Sam

Samual Sam

Updated on 27-Jun-2020 09:30:10

222 Views

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

Gregorian Calendar in Java

Samual Sam

Samual Sam

Updated on 27-Jun-2020 09:13:00

1K+ Views

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

Set the Date and Time with Gregorian Calendar in Java

Samual Sam

Samual Sam

Updated on 27-Jun-2020 09:07:16

2K+ Views

To work with the GregorianCalendar class, import the following package.import java.util.GregorianCalendar;Create a Date object.Date d = new Date();Now, create an object and set the time using the setTime() method.GregorianCalendar cal = new GregorianCalendar(); cal.setTime(d);The following is an example.Example Live Demoimport java.util.Date; import java.util.GregorianCalendar; public class Demo {    public static void ... Read More

Get the last day of month in Java

Samual Sam

Samual Sam

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

14K+ Views

The getActualMaximum() method returns the maximum value that the specified calendar field could have, based on the time value of this Calendar.Import the following package to work with Calendar class in Java, import java.util.Calendar;Create a calendar object.Calendar cal = Calendar.getInstance();Use the getActualMaximum() method to get the last day of the ... Read More

Get time in milliseconds using Java Calendar

Samual Sam

Samual Sam

Updated on 27-Jun-2020 09:02:34

803 Views

Create a Calendar object.Calendar cal = Calendar.getInstance();For using above Calendar class, do not forget to import the following package.import java.util.Calendar;Now, use the getTimeInMillis() method to get the time in milliseconds.cal.getTimeInMillis()The following is the final example.Example Live Demoimport java.util.Calendar; public class Demo {    public static void main(String[] args) {     ... Read More

Display Day Name of Week using Java Calendar

Samual Sam

Samual Sam

Updated on 27-Jun-2020 08:55:52

4K+ Views

For using Calendar class, import the following package.import java.util.Calendar;Using the Calendar class, create an object.Calendar calendar = Calendar.getInstance();Now, create a string array of the day names.String[] days = new String[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };Display the day name.days[calendar.get(Calendar.DAY_OF_WEEK) - 1]The following is the final example.Example Live Demoimport ... Read More

Convert the Current Time to a java.sql.Date Object

Samual Sam

Samual Sam

Updated on 27-Jun-2020 08:49:02

647 Views

Firstly, create a Calendar class object.Calendar calendar = Calendar.getInstance();Now, import the following package.import java.sql.Date;Using a Date class now and creating an object would belong to the above package. Convert the current time to the java.sql.Date Object.Date sqlDate = new Date((calendar.getTime()).getTime());The following is an example.Example Live Demoimport java.util.Calendar; import java.sql.Date; import java.text.ParseException; ... Read More

Advertisements