Click to See Complete Forum and Search --> : Q. how do I obtain the date and time information?


soichih
February 22nd, 2000, 10:49 AM
I'd like to know how to get the date and time information and send them to the cgi program.

When I define the variable in javascript, say

var date="02/24/00"



how do I set the "post" envoronment data so that my cgi program access to it? Or should I use "get" method? and how?

I've been asking same question many times and nobody has ever answered me. So somebody please help!

thank you


------------------------------
i am a beginner, and am the one who will be greately appriciated with any type of help.

February 22nd, 2000, 01:03 PM
java.util.Date d = new java.util.Date(); // get current time
String s = d.toString(); // in displayable format

Does this help?

cactus25
February 23rd, 2000, 10:54 AM
java.util.GregorianCalendar C = new java.util.GregorianCalendar();

int mon = C.get(C.MONTH) + 1; //the MONTH field is 0-11
int day = C.get(C.DAY_OF_MONTH);
int year = C.get(C.YEAR);

String s = s.valueOf(mon) + "/" + s.valueOf(day) + "/" + s.valueOf(year);
System.out.println("Date is : " + s);




output is
Date is : 2/23/2000