Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Input Timestamp in JSP

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Location
    Kochi,India
    Posts
    18
    My Mood
    Confused
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Unhappy Input Timestamp in JSP

    hi

    i've got a small problem. I've to create a JSP with two input fields ie. From Time & To time. After the user inputs i've to compute the difference between fromtime and totime and display the diff in the same jsp. Is there a tag as timestamp in jsp? Or should i accept it as strings and then convert them?

    Also if i've to use strings, then is it possible to format the input ie. i do not want the user to type the : between hh & mm.

    i'm rather confused. which is the best approach?


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Input Timestamp in JSP

    This can get quite complicated at times but is also very easy to resolve.

    Either you can use heavy clientside Javascript or the likes to make sure the user is only allowed to input stuff in a certain format or even use a library that will give the user a nice date/time input box.

    You can also go the other way of having a plain input box, let the user type whatever they want and then try to convert it server side and then tell them off if they've input the datetime in the wrong format.

    Or of course, you can use both.

    // Json

  3. The Following User Says Thank You to Json For This Useful Post:

    jai (March 4th, 2011)

Similar Threads

  1. How to get unix timestamp from formatted date?
    By snytkine in forum Java Theory & Questions
    Replies: 5
    Last Post: October 12th, 2010, 08:07 AM
  2. Stuck, looking for input
    By ptabatt in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 30th, 2010, 02:54 AM
  3. Getting input
    By BuhRock in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 22nd, 2010, 10:30 AM
  4. [SOLVED] allow a new input, dicarding the last mismatch input without terminating the program
    By voltaire in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 9th, 2010, 04:44 AM
  5. Values of Input
    By chronoz13 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: November 8th, 2009, 03:46 AM