ankit rastogi wrote: > I am using 2 datepickers in ome of my lzx under openlaszlo 3.2 . I set > current date using selecteddate=new Date() for one date picker while for > another I want to set it to 3 days previous of currentdate. > > Using var newdate = (new Date())-3 gives me seconds since UTC. > How can I do subtraction or addition on current date and get date of 2 > days fture from today or date of 10 days previous from current date.
You would need to tranform the date object into days and then do your subtraction that way, then you can turn it back to what ever format you want. E.g.: [CODE] var selecteddate = new Date(); var earlier = new Date(); // sets the time to 3 days before... |<-- secs in a day -->| earlier.setTime( earlier.getTime() - ( 3 * ( 1000 * 60 * 60 * 24 ) ) ); /** * earlier is now set to the time 3 Days earlier * so if you print the earlier variable you would * get the time 3 days ago */ [/CODE] I hope this is clear?! Adeola. _______________________________________________ Laszlo-user mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-user
