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;
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _ | http://forcoder.org | free video tutorials and ebooks about \ Visual Basic .NET Swift Delphi C Perl PHP Visual Basic JavaScript Python MATLAB Objective-C Scratch Java PL/SQL Ruby C++ Go C# R Assembly Apex VBScript Lisp Crystal Scheme Logo Rust Hack COBOL ABAP Scala F# Dart Alice Kotlin FoxPro LabVIEW Lua SAS Transact-SQL Clojure ML Prolog Erlang Julia Bash Ada Fortran D Awk \ ______

Sign In or Register to comment.