Skip to main content
Kinetic Community

Helper: DateHelper

Helpers are essentially Java classes that can be used in JSP pages.  The DateHelper is a core helper (meaning that it rarely, if ever be modified).  It includes helper methods for working with Dates.

Methods

DateHelper.formatDate(dateString, locale)

Parameters: String, java.util.Locale

Returns: String

Returns a date string formatted for the specified locale.  The format of the input dateString is expected to be "MM/dd/yyyy HH:mm:ss".

Example

<%
  String usDate = "02/22/1971 14:04:00";
  java.util.Locale australia = new java.util.Locale("en", "AU");
  String auDate = DateHelper.formatDate(usDate, australia);
%>
<div class="auDate"><%= auDate %></div>

 

The results of the above code will display the Autralian version of this date as:

<div class="auDate">22/02/1971 2:04:00 PM</div>

DateHelper.getCurrentYear()

Parameters:

Returns: String

Returns the current four digit year value as a string.

Example

<% String currentYear = DateHelper.getCurrentYear(); %>
<div class="currentYear"><%= currentYear %></div>

 

The results of the above code at the time of this writing would be:

<div class="currentYear">2012</div>