Home Answers Viewqa Java-Beginners I am writing a program which converts a string to a timestamp and add days to it

 
 


Arun Krishna
I am writing a program which converts a string to a timestamp and add days to it
0 Answer(s)      a year and 4 months ago
Posted in : Java Beginners

java.sql.Timestamp ts2 = java.sql.Timestamp.valueOf("2012-01-11 12:34:39"); long l=ts2.getTime() +(100060602424);//add 24 days Date d=new Date(l); System.out.println(d);

output=Sat Feb 04 12:34:39 IST 2012 //correct

java.sql.Timestamp ts2 = java.sql.Timestamp.valueOf("2012-01-11 12:34:39"); long l=ts2.getTime() +(100060602424);//add 25 days Date d=new Date(l+10006060247); System.out.println(d);

output=Sat Dec 17 19:31:51 IST 2011

Please can any one tell why this is coming wrong? Thanks a lot.

View Answers









Related Pages:
I am writing a program which converts a string to a timestamp and add days to it
I am writing a program which converts a string to a timestamp and add days...:34:39"); long l=ts2.getTime() +(100060602424);//add 24 days Date d=new Date(l...=ts2.getTime() +(100060602424);//add 25 days Date d=new Date(l+10006060247
A program which converts feet and inches to centimeters.
Java: Exercise - InchesToCm Write a program which converts feet... should terminate the program. If there is an error in converting either... in any special way (ie, you can use the default number to string conversion
PHP Date add days
In this example we will create sample code to add days or weeks...;days: ".date('l dS \o\f F Y', $date)."<br>"; ?> Here is the output of the program: Current Date
I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.
I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.  I am reading the file using BufferedReader, then writing the output like this: String
Mysql Date Add Days
which you want to add days. INTERVAL expr unit:- Number of the days you want... Mysql Date Add Days       The Tutorial illustrate an example to add days to the particular days
Set Timestamp by using the Prepared Statement
object according to database table (rname, rtime). Here we wish to add Timestamp.... The JDBC driver converts it into the SQL TIMESTAMP value. It takes integer type index value and Timestamp value in millisecond. Here is the code of program
Writing a GUI program - Java Beginners
Writing a GUI program  Hello everyone! I'm trying to write a program...(ActionEvent e) { String value = text.getText(); int i = 0... if that number is prime or not. When the second button is pressed the program
I/O Program output error
I/O Program output error  Hello All, I am working on a program... file, but I am getting incorrect output. I have been successfull with part of the program in that it reads the text file and analyzes it, however I need it to take
i am unable to identify the error in my code
i am unable to identify the error in my code  class Program { public static void main(String[] args) { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter
i am unable to identify the error in my code
i am unable to identify the error in my code  class Program { public static void main(String[] args) { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter
Am i convetrting the code right ? - Java Beginners
Am i convetrting the code right ?  C# private void button... (PortInUseException ex) { } I have a device on the serial port which has...(SerialPort.GetPortNames()[0], 9600, Parity.None, 8, StopBits.One); String[] str
Timestamp value and query
Timestamp value and query  convert a string to timestamp and pass it into database settimestamp value We get a string from jsp.The string value is a date and time value. Convert the string value to a timestamp and a query
Hi ..I am Sakthi.. - Java Beginners
Hi ..I am Sakthi..  can u tell me Some of the packages n Sub... get more title"); //Add the tabbed pane to this panel. setLayout(new GridLayout(1, 1)); add(tabbedPane); } private
writing program - Java Beginners
); } for(int i=0;i<5;i++){ ShowData show = data[i]; String...writing program  WAP to input Name of Cricketer, Number of matches... code: import java.util.*; class ShowData implements Comparable{ String n
Not sure what I am missing ? Any ideas?
Not sure what I am missing ? Any ideas?  import java.util.*; public class HangMan2 { char guess; String userInputs; String word; static String[] userInput; static Scanner scan = new Scanner
JAVA Write code which converts propositional expressions into clauses using the INOA rules
JAVA Write code which converts propositional expressions into clauses using the INOA rules  Write code which converts propositional expressions... <=> q is written as imp p q. Typical dialog should be this, where I have
Writing First Hibernate Code
or from command prompt as well. I am assuming that you are familiar with MySQL...;} } In the next section I will show how to run and test the program.  ... Writing First Hibernate Code     
I am new to programming and I am not sure what to do next? Any ideas?
I am new to programming and I am not sure what to do next? Any ideas?  import java.util.*; public class HangMan2 { char guess; String... if the character c // is inside the String str. A true is returned
Writing Calculator Program in Swing
Writing Calculator Program in Swing       In this tutorial we are providing you an example which... shot. For developing a small calculator program in swing we need two different
writing program in bluej - Java Beginners
writing program in bluej  How to write the program on follwing WAP to inpout a string and print Input : I stidied Hard   Hi Friend... static void main(String[]args){ System.out.print("Enter String:"); Scanner
Need help writing a console program
Need help writing a console program  I need help cant seems to figure it out! Write a program that consists of three classes. The first class will be the actual program. The second class will simply convert a string to lower
Writing and Reading A File
I want java to store the customer information permanently. But I am so confused...[]={text3.getText()}; String sal[]={text4.getText()}; String add[]={text5.getText... i = 0; i < id.length; i++) { String line = id[i]+" "+name[i]+" "+des[i
File Writing - Java Beginners
File Writing  Hi... I need a syntax or logic or program by which we can write into the desired shell of the Excel file from console window...  Hi friend, I am sending you a link. This is will help you. Please
writing and appending to a file
for females and write into a different 'female string' in the same program? Sorry If I am confusing you!!! But I want something like "going through my input...writing and appending to a file  My input file includes data from
Determining the Number of Days in a Month
Determining the Number of Days in a Month   This section will show the way of counting the number of days of a month in the specified year. Following program takes the year as input through the keyboard and shows the number of days
Writing a Program to calculate Circumference of planets reading from a file and writing to new file.
Writing a Program to calculate Circumference of planets reading from a file and writing to new file.  Hello, I would like to know how to write... the integers represent the diameter. I have most of the code, but I am
Dialog I/O: Kilometers to Miles
Java NotesDialog I/O: Kilometers to Miles This basic program asks the user for a number of miles and converts it to kilometers. It uses JOptionPane for all input and output. Convert String to a number. We have to convert
add
Java Program to add two numbers  Java Program to add two numbers  Here is a java example that accepts two integer from the user and find...(String[] args) { Scanner input=new Scanner(System.in
Writing code with multiple Class Methods and String Arrays
Writing code with multiple Class Methods and String Arrays  So what I am trying to do is create a code that lists music artists names using user... In these classes I need to create string arrays that contain artist names, and be able
Writing code with multiple Class Methods and String Arrays
Writing code with multiple Class Methods and String Arrays  So what I am trying to do is create a code that lists music artists names using user... In these classes I need to create string arrays that contain artist names, and be able
Convert Date to Timestamp
a date into a timestamp format.  Description of program: The following program helps you in converting a date... Convert Date  to Timestamp   
Writing a Program to calculate Circumference of planets reading from a file and writing to new file.
Writing a Program to calculate Circumference of planets reading from a file and writing to new file.  Hello, I would like to know how to write... the integers represent the diameter. I have most of the code, but I am stumped when
program
which should print "IIT Mumbai" in console. Inside the main method instantiate the College class and invoke the method.   hi dhivya, Here I am giving an example of your problem. public class College { String str = "IIT
String Exception Program - JSP-Servlet
String Exception Program  Respected Sir/Madam, I am... much.. Actually in the upload_page.jsp code which you have sent, I am getting the JasperException StringIndexOutOfBound Exception- 54164.. I am sending
i am inserting an image into database but it is showing relative path not absolute path
i am inserting an image into database but it is showing relative path... type="text" name="pno"><br><br> <input type="submit" value="add...; &lt;% try { String name=request.getParameter("sname
how to include Timestamp into my enquiry form? - Java Beginners
how to include Timestamp into my enquiry form?  Dear expert, I'd like to include a timestamp function into my enquiry form. However, I am stuck at the servlet portion whereby I want to map my Timesatmp class to my update
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations ..." name="verify" method="POST"> <% String USERNAME=""; USERNAME=(String)session.getAttribute("USER"); String ADMIN=""; ADMIN=(String
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations ..." name="verify" method="POST"> <% String USERNAME=""; USERNAME=(String)session.getAttribute("USER"); String ADMIN=""; ADMIN=(String
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations ..." name="verify" method="POST"> <% String USERNAME=""; USERNAME=(String)session.getAttribute("USER"); String ADMIN=""; ADMIN=(String
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations ..." name="verify" method="POST"> <% String USERNAME=""; USERNAME=(String)session.getAttribute("USER"); String ADMIN=""; ADMIN=(String
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations ..." name="verify" method="POST"> <% String USERNAME=""; USERNAME=(String)session.getAttribute("USER"); String ADMIN=""; ADMIN=(String
Hi..How to Display Days by month - Java Beginners
Hi..How to Display Days by month  Hi Friend.... I have a doubt on date Program... How to display the Number of days..it should display... feb 28 days .. Like that .. Can u plz Guide me.. Monday i have teach
problem of writing to a local file ( JApplet ) - Applet
problem of writing to a local file ( JApplet )  Dear All, I want to program a guestbook using java applets but now I have problem of writing to a file from JApplet. it is working without any problem if i run the program using
I need add my java program with a picture.
I need add my java program with a picture.  Good evng Frnds Friends i created 1 jar file in my desktop. I need add this program with 1 picture. Whenever the user double clicking on that picture The program must start instead
javascript add hour to time
javascript add hour to time  I want to add numbers of hours to time... date. Input hours which you want to add into current time.parseInt() is used to convert the value in integer.Simple add hours into the current hour by writing
javascript add minutes to time.
javascript add minutes to time.  I want to add minutes to time. How... minutes which you want to add into current time.parseInt() is used to convert the value in integer. Simple add minutes into the current minutes by writing var
javascript date difference in days.
javascript date difference in days.   I want to find the difference between two dates in terms of days. I am using javascript. Please help.  ... of days by using method getDay(). Now to find date difference
i written the program in the files but in adding whole file is writing once again - Java Beginners
i written the program in the files but in adding whole file is writing once again  Very Urgent: Write a small record management application file and it should not be re-written for every add/delete operation.  Hi
Add color to background but I can't labels or textfields
Add color to background but I can't labels or textfields  Please help... JTextField(10); con.add(l1); con.add(tf1);   I am very new to Java, I followed your instruction and this is what I came up with, am I missing something
javascript add seconds to time.
javascript add seconds to time.  I want to add seconds to time. How can I do this?   <html> <head> <title>Add seconds... add seconds into the current second by writing var newSec = parseInt(seconds

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.