i needed a simple way to generate a date string so i could set a rich:calendar textbox input field using a sahi script, so here's sample code for one solution to generating tomorrow's date as a text string:
var $formattedDate = java.util.Calendar.getInstance();
$formattedDate.add(java.util.Calendar.DAY_OF_YEAR, 1);
$formattedDate = new java.text.SimpleDateFormat("dd.MM.yyyy").format($formattedDate.getTime());
_alert($formattedDate);
which will give output like:
14.09.2013
it's cool how you can call java directly in the sahi code :)
thanks to the post how to add the specific number of days to a date which was obtained
No comments:
Post a Comment