The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)

20130913

sahi - how to get tomorrow's date in the format dd.MM.yyyy

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