Question about Microsoft Computers & Internet

1 Answer

Who to manuplate the date in java

I have to read the system date and i will increment date to 10 or 15 days
the data format will be like this
13/3/1985

please any one guide me to solve this problem

Posted by on

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that got 5 achievements.

    Mentor:

    An expert who has written 3 tips or uploaded 2 video tips.

    Governor:

    An expert whose answer got voted for 20 times.

  • Expert
  • 80 Answers

Date arithmetic is relatively easy if you remember that time in JavaScript is measured in milliseconds. Use the date method getTime() to determine the number of milliseconds that have elapsed since the magic date of January 1, 1970. Use the setTime() method to establish a date you have calculated in term of milliseconds.

Danny Goodman, author of the JavaScript bible recommends that you set up some variables that build on each other to make it easier to do Date Arithmetic. Here is the variable setup that he recommends:

var oneMinute = 60 * 1000 // milliseconds in a minute
var oneHour = oneMinute * 60
var oneDay = oneHour * 24
var oneWeek = oneDay * 7

So for your case (date for 10 days after today), we can declare like this:

<SCRIPT language="JavaScript">

var today = new Date();
var mm= today.getMonth();
var dd = today.getDate();
var yyyy = today.getFullYear();
var oneMinute = 60 * 1000; // milliseconds in a minute
var oneHour = oneMinute * 60;
var oneDay = oneHour * 24;
var dateInMS = today.getTime() + oneDay * 10;
var TargetDate = new Date (dateInMS)
document.write("Today is: " + mm + "/" + dd + "/" + yyyy);
document.write("<br />");
document.write("10 days after today is: " + TargetDate);

</SCRIPT>


P.S.: If this information was helpful, please rate this solution.

Posted on Mar 12, 2009

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

I have java on my computer and you don't recognize it and I cant get into games


Two thing either it is out of date which don't feel bad there they update like every 2 days or your configuration is bad and you have to uninstall and re-install

Oct 18, 2013 | Computers & Internet

1 Answer

What is the meaning of matrix and matrices in java?


in java a matrix is a collection of data in rows and columns format.matrices is the plural of matrix

Sep 20, 2011 | Computers & Internet

1 Answer

Java has fatal errors when I play pogo. chat box covers part of game


Try updating the Java run-time on your computer. If it is out of date, your Java content may not work. You can update Java at http://www.Java.com.

Regards,

D

Sep 03, 2011 | Computers & Internet

1 Answer

Please help am going to get fired lost company data while i was formatting it,how can i retrieve the data?am using apire 5332


every pc has an option of restoring datas..
START menu->->All programs->Accessories->System Tools->System restore->
Then its user friendly . Jus follow the instructions and restore your pc to the earlier date frm the date u formated it.
Good luck

Dec 22, 2010 | Computers & Internet

1 Answer

I accidentally installed arabic localiser on my htc hd2 it erased all my contacts & messages and since i can't read arabic i don't know how or where to touch to uninstall. please help


prove to make the reatore of a older day date as you have instal this software.i dont know the exact name of english. but you have in your pc a sistem to bring the pc to a old day data. you must bring back the computer to a day date before the problem. i hope you have aunderstand. reatore to a earlier date...ok prove i mean you can solve the problem sorry for my bad english dont forgith to release your opinion if i have help you. thanks

Aug 10, 2010 | Computers & Internet

2 Answers

Somehow java was uninstalled from my pc, when i try to reinstall i get an error 2318


Are you actually using the Java Desktop, on a Solaris box, or did you see a note that something can't find the jdk or java?  In the latter case, just go to Java.com ...in the former, I think maybe you ran short of the 5GB free space install baseline, but you can check Google and the Sun forums to get some better clues if your manuals seem dry of relevance.

Nov 14, 2009 | Sun Java Desktop System

1 Answer

Java


Look into using the Process class to execute a command you might use on the command line (DATE in your case). Small tutorial that you can use to get you started is at: http://java.sun.com/developer/JDCTec.../tt0304.html#1

You'll probably have to run this command with administrator privileges...not too familiar with Windows.

On a side note, if you use this approach, the example doesn't close any of the streams that were opened to read the output of the command issued. You should do this to avoid unwanted resource consumption.
golu_fixya
thanks

Oct 14, 2008 | Computers & Internet

2 Answers

Java project (core and advanced)


Hi I am Nitin Daharwal .. If you want make project in Java using Swing only. You may opt for these options 1. Java Image Viwer 2. Exam Simulator 3. Bulk E mail 4. Snake Game 5. Chatting Client 6.Inventory Mangement System you can mail at nitin.daharwal@gmail.com for any help ..

Happy Programming!!!

Sep 25, 2008 | Microsoft Windows XP Professional

1 Answer

Pls hepl me wit Excel VB integration


you can use a OLE object that is available in VB as standard object. Drag the tools to your form that your creating and it will ask for create or link existing object. so now browse to the excel sheet and embed it into the VB form or use run time for manuplating the cells and other info in excel.

Mar 25, 2008 | Computers & Internet

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

324 people viewed this question

Ask a Question

Usually answered in minutes!

Top Microsoft Computers & Internet Experts

micky dee

Level 3 Expert

2638 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18333 Answers

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

Are you a Microsoft Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...