Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Changing a String variable to a DATE variable???

Y_TY_T Member Posts: 2
Hi, I have a JSP page that is using the CALENDAR object to edit a date, but the calendar object returns the result as a STRING type. I need to convert that string variable back to a DATE variable so I can insert the value into my DB table field (type DATE). Any ideas????

Thanks

YT

Comments

  • ozkrozkr Member Posts: 34
    : Hi, I have a JSP page that is using the CALENDAR object to edit a date, but the calendar object returns the result as a STRING type. I need to convert that string variable back to a DATE variable so I can insert the value into my DB table field (type DATE). Any ideas????
    :
    : Thanks
    :
    : YT
    :

    the method getTime returns a Date Object.

    http://java.sun.com/j2se/1.4/docs/api/java/util/Calendar.html#getTime()
  • gnairgnair Member Posts: 17
    : : Hi, I have a JSP page that is using the CALENDAR object to edit a date, but the calendar object returns
    the result as a STRING type. I need to convert that string variable back to a DATE variable so I can insert the value into my DB table field (type DATE). Any ideas????
    : :
    : : Thanks
    : :
    : : YT
    : :
    :
    : the method getTime returns a Date Object.
    :
    : http://java.sun.com/j2se/1.4/docs/api/java/util/Calendar.html#getTime()
    :

    Date formats vary greatly in locale implementation, despite this u could try casting the
    supposed date string(if its well behaved) back to a date or calendar object:
    Date objDate;
    objDate = (Date)string;
  • gnairgnair Member Posts: 17
    : : Hi, I have a JSP page that is using the CALENDAR object to edit a date, but the calendar object returns
    the result as a STRING type. I need to convert that string variable back to a DATE variable so I can insert the value into my DB table field (type DATE). Any ideas????
    : :
    : : Thanks
    : :
    : : YT
    : :
    :
    : the method getTime returns a Date Object.
    :
    : http://java.sun.com/j2se/1.4/docs/api/java/util/Calendar.html#getTime()
    :

    Date formats vary greatly in locale implementation, despite this u could try casting the
    supposed date string(if its well behaved) back to a date or calendar object:
    Date objDate;
    objDate = (Date)string;
Sign In or Register to comment.