Getting value from session

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • koneru9999
    New Member
    • Jul 2007
    • 6

    #1

    Getting value from session

    i have one storedprocedure in database.from that i can get last login time .i fetched that value and assigned that value to session in one servlet class.from that session i am getting that last login time value and displaying in a jsp page.
    the value is displaying.upto this is ok.
    but if i want to format that date and time why i am not able to do that.
    when i am doing format with SimpleDateForma t()..it is giving error.
    what i have to do?
    thanx in advance...
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by koneru9999
    i have one storedprocedure in database.from that i can get last login time .i fetched that value and assigned that value to session in one servlet class.from that session i am getting that last login time value and displaying in a jsp page.
    the value is displaying.upto this is ok.
    but if i want to format that date and time why i am not able to do that.
    when i am doing format with SimpleDateForma t()..it is giving error.
    what i have to do?
    thanx in advance...
    Post the code that is giving you the errors

    Comment

    • koneru9999
      New Member
      • Jul 2007
      • 6

      #3
      this code snippet is giving error..


      SimpleDateForma t lastaccesstime = new SimpleDateForma t("dd mmm yyyy hh:mm:ss");

      lastaccesstime. format(session. getAttribute("l astlogindatetim e"));


      is there any wrong?

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by koneru9999
        this code snippet is giving error..


        SimpleDateForma t lastaccesstime = new SimpleDateForma t("dd mmm yyyy hh:mm:ss");

        lastaccesstime. format(session. getAttribute("l astlogindatetim e"));


        is there any wrong?
        You have to type cast the object from session.getAttr ibute to a date first.
        Have a look at the specification of the format method.

        Comment

        Working...