How to print current date in JSP?

Use jsp:useBean to construct a java.util.Date instance and use JSTL fmt:formatDate to format it into a human readable string using a SimpleDateFormat pattern. <%@ taglib uri=”http://java.sun.com/jsp/jstl/fmt” prefix=”fmt” %> <jsp:useBean id=”date” class=”java.util.Date” /> Current year is: <fmt:formatDate value=”${date}” pattern=”yyyy” /> The old fashioned scriptlet way would be: <%= new java.text.SimpleDateFormat(“yyyy”).format(new java.util.Date()) %> Note that you need … Read more

Java Time Zone When Parsing DateFormat

tl;dr OffsetDateTime.parse( “2010-12-27T10:50:44.000-08:00” ) ISO 8601 The input string format is defined in the ISO 8601 standard, a family of date-time formats. Avoid old date-time classes The Question and other Answers use old outmoded date-time classes bundled with the earliest versions of Java. Avoid them. Now supplanted by the java.time classes. Using java.time Your input … Read more

mysql date comparison with date_format

Your format is fundamentally not a sortable one to start with – you’re comparing strings, and the string “28-10-2012” is greater than “02-11-2012”. Instead, you should be comparing dates as dates, and then only converting them into your target format for output. Try this: select date_format(date(starttime),’%d-%m-%Y’) from data where date(starttime) >= date ‘2012-11-02’; (The input … Read more

Android: How to change the DatePicker view date format from MM/dd/yyyy to dd/MM/yyyy?

To override the DatePicker format the best bet would be to override one of its constructors with a slight edit to the original code. You can edit the ViewGroup in code for you but I’d seriously consider not doing it that way. Create class LocalizedDatePicker Override public DatePicker (Context context, AttributeSet attrs, int defStyle) http://developer.android.com/reference/android/widget/DatePicker.html#DatePicker(android.content.Context, … Read more