CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 1999
    Location
    Arkansas, USA
    Posts
    308

    Q. how do I obtain the date and time information?

    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.

  2. #2
    Guest

    Re: Q. how do I obtain the date and time information?


    java.util.Date d = new java.util.Date(); // get current time
    String s = d.toString(); // in displayable format

    Does this help?


  3. #3
    Join Date
    Apr 1999
    Location
    tx
    Posts
    37

    Re: Q. how do I obtain the date and time information?


    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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured