我的控制器类是
@RequestMapping(method = RequestMethod.POST, value = "/auditregistry/collectionentry/cid/{cid}/collid/{collid}/colldt/{collectiondate}/amount/{amt}")
public ModelAndView saveManualCollection(@PathVariable("cid") Integer custId, @PathVariable("collid") Integer collRtId, @PathVariable("collectiondate") String dt, **@PathVariable("amt") String amount**) throws Exception
{
debug("amount recieving=="+amount);
Run Code Online (Sandbox Code Playgroud)
我传递给网址的值是
/ auditregistry/collectionentry/cid/9991/collid/10/colldt/20120726/amount/$ 14.55
当我试图打印金额值打印为"14美元"而不是"14.55美元"我该怎么做才能打印实际价值"14.55美元"
任何帮助都非常感谢
我的输入字符串为2012-07-27,我希望输出为日期,但格式与2012-07-27相同
我的代码是
DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
try {
Date today = df.parse("20-12-2005");
System.out.println("Today = " + df.format(today));
} catch (ParseException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
我的输出是
Fri Jul 27 00:00:00 IST 2012
Run Code Online (Sandbox Code Playgroud)
但我想返回日期对象,如2012-07-26 23:59:59而不是字符串任何帮助请
任何帮助都非常感谢