1 4 package com.openedit.modules.dates; 5 6 import java.text.SimpleDateFormat ; 7 import java.util.Date ; 8 9 import com.openedit.WebPageRequest; 10 import com.openedit.modules.BaseModule; 11 import com.openedit.page.PageAction; 12 13 17 public class DateModule extends BaseModule 18 { 19 20 public void now(WebPageRequest inReq) throws Exception 21 { 22 PageAction inAction = inReq.getCurrentAction(); 23 24 Date date = new Date (); 25 inReq.putPageValue("now",date); 26 27 String format = inReq.getRequestParameter("format"); 28 29 if ( format == null) 30 { 31 format = inAction.getChildValue("format"); 32 } 33 if ( format != null) 34 { 35 SimpleDateFormat sformat = new SimpleDateFormat (format); 36 String fdate = sformat.format(date); 37 inReq.putPageValue("formatteddate",fdate); 38 } 39 } 40 } 41 | Popular Tags |