What is standard way to manage with the date object in the web based applications?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sundar_manyapu
Posted On:   Wednesday, February 6, 2002 02:22 AM


In our application(Web based) we try to manage the date objects by converting into a String object.



Whenever a manipulation of the date is required it will be converted from String to Date object and do the necessary operation(say addition or subtraction) and then change back into a String.


Here i would like to know the standard way we have to approach, its merits and demerits.



Regards

Sundar

Re: What is standard way to manage with the date object in the web based applications?

Posted By:   Wesley_Hall  
Posted On:   Wednesday, February 6, 2002 09:32 AM

Im working on a project right now that uses Strings to represent Date objects and it is not working out too well for us. You will find you will have to write lots of converstion and logic type methods and you string format will be unique to you. Much better to use the getTime() method of Date and use a long, the long value is the number of milliseconds since 12AM Jan 1st 1970 so it is easy to perform transforation on this long value (want to add a day, add 1000 * 60 * 60 * 24).

Also you might notice that in the API ref the Date(long) constructor is the only one not deprecated (except obvious the default one)
About | Sitemap | Contact