|
DatesDates in SalsaScript are normal Javascript Date Objects that can be saved to the database, read from the database, and manipulated and formatted. Formatting a DateFrequently you may need to format how a Javascript date is displayed to the screen. While you can use the standard Javascript .getDate(), .getYear() etc., Salsa also provides a convenient formatting method salsa.formatDate(Date,format) <? var currentDate=new Date(); ?> Current Date=<?=salsa.formatDate(currentDate,"MMM dd, yyyy")?>results in: Current Date=Jul 29, 2010The optional format string follows the same rules as the Java SimpleDateFormat class. |