Hi All,
I need to dispaly the current date time in a jsp page.
I am calling javascript for calender.
My code is
function getCurrentDateString() { alert("getCurrentDateString()"); var ff = new SimpleDateFormat("yyyy/MM/dd"); var n = new Date(); var result = ff.format(n); alert('res->' + result); return result; }
Its not working .
Anyone help me out ....
In java it works fine..
import java.text.SimpleDateFormat;import java.util.*; public class Sample { static public void displayDate() { Date today; String result; SimpleDateFormat formatter; formatter = new SimpleDateFormat("yyyy/MM/dd : HH/mm/ss"); today = new Date(); result = formatter.format(today); System.out.println("Result: " + result); } static public void main(String[] args) { displayDate(); }}