• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.util.Calendar

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got an error message saying:
Cannot assign value of type 'java.lang.String' to property 'last_logon_date' of type 'java.util.Calendar'
What value I should give that is of type 'java.util.Calendar'?
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See the doc for the set( field, value) method. You can set individual year, month, day, hour, minute, second fields. A major pain.
If you have a string date in a known format, you can use the DateFormat class to parse it and create a Date, then setTime on the Calendar. I find the date handling in Java very icky (set TIME indeed!) and always code this stuff with the JDK doc open.
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did not explain my problem better. Sorry.
I have a form for users to fill out the text field. I specify the field as of java.util.Calendar type.
During testing, I filled out the text field with a date in various ways (for example, 06/27/2003, June 27, 2003, etc.) The computer always gave an error message saying the information I had given was of String type.
Therefore, I am wondering what value is of java.util.Calendar type.
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to convert your String to a java.util.Calendar.
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for advices.
reply
    Bookmark Topic Watch Topic
  • New Topic