Snippets tagged “calendar”
12 snippets use this tag.
- Calculate date/time difference in javaJava
To calculate the difference between two dates in Java, you can use the java.time package (part of Java 8 and later) or the java.util.Calendar class (part of the older java.util package).
- Calendar date to yyyy-MM-dd format in javaJava
To format a Calendar date in the yyyy-MM-dd format in Java, you can use the SimpleDateFormat class.
- Display current time in 12 hour format with AM/PMJava
To display the current time in 12-hour format with AM/PM in Java, you can use the SimpleDateFormat class and the Calendar class.
- Get integer value of the current year in JavaJava
To get the integer value of the current year in Java, you can use the Calendar class and the get method.
- How to compare dates in Java?Java
You can compare dates in Java by using the compareTo() method of the java.util.Date class. This method compares the date object on which it is called with the date object passed as an argument to the method
- How to determine day of week by passing specific date?Java
To determine the day of the week for a specific date in Java, you can use the get() method of the Calendar class.
- How to get the last day of the month?Python
You can use the calendar.monthrange() function from the calendar module in Python to get the last day of a month.
- How to set time zone of a java.util.Date?Java
To set the time zone of a java.util.Date object in Java, you can use the Calendar class.
- How to subtract X day from a Date object in Java?Java
To subtract a certain number of days from a Date object in Java, you can use the Calendar class.
- Java: Get month Integer from DateJava
To get the month integer from a java.util.Date object in Java, you can use the getMonth() method of the java.util.Calendar class.
- java.util.Date to XMLGregorianCalendarJava
To convert a java.util.Date object to an XMLGregorianCalendar in Java, you can use the toGregorianCalendar method of the DatatypeFactory class.
- Simple DatePicker-like CalendarPHP
A simple DatePicker-like calendar can be created using the PHP DateTime class and some basic HTML and CSS.