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 to it

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 Tutorials/Questions & Answers:
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
How to convert String Date to Timestamp in Java?
String Date to Timestamp example in Java Java is programming language.... In this example program we are going to convert String representation of Date object... is used by the JDBC API to identify SQL TIMESTAMP. This class add
Advertisements
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
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
write a program in java Adding up the subscript(st,nd,rd,th) to the number of days in a input string
write a program in java Adding up the subscript(st,nd,rd,th) to the number of days in a input string    write a program in java Adding up the subscript(st,nd,rd,th) to the number of days in a input string ex:If a user enters
Mysql Date Add Days
Mysql Date Add Days       The Tutorial illustrate an example to add days to the particular... you the way to add days to the particular date. SYNTAX:- ADDDATE(date,INTERVAL
PHP Date add days
In this example we will create sample code to add days or weeks...;adding 30 days: ".date('l dS \o\f F Y', $date)."<br>"; ?> Here is the output of the program
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
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
string program
string program  reads sentence and find the average length of word... AverageLengthOfWords { public static void main(String[] args...); System.out.print("Enter sentence: "); String st=input.nextLine(); String str
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
string program
string program  write a program to print the pattern p r o program r a m
Write a program that converts any given year to Roman Numeral in Java
Write a program that converts any given year to Roman Numeral in Java  Write a program that converts any given year to Roman Numeral
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
string program
string program  wap to find single occurrence of given string in java without using any predefined method
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 angularjs hello world program
writing angularjs hello world program  Hi, I just started to learn... tutorials. I want to make simple program and thinking to start from the Hello World program in AngularJS. Searching for simple example for writing angularjs
Can I learn java in 20 days?
Can I learn java in 20 days?  Hi, I want to learn Java in 20 days. I... should I learn? Can I learn java in 20 days? Thanks   Hi, Complete... days is good to learn Core Java and Advanced Java. You can many spend 3 hours
Can I learn java in 20 days?
Can I learn java in 20 days?  Hi, I want to learn Java in 20 days. I... should I learn? Can I learn java in 20 days? Thanks   Hi, Complete... days is good to learn Core Java and Advanced Java. You can many spend 3 hours
Write a function that reads a string of digits, possibly preceded by + or -, and converts this string to the integer value it represents.
Write a function that reads a string of digits, possibly preceded by + or -, and converts this string to the integer value it represents.  Write a function that reads a string of digits, possibly preceded by + or -, and converts
String program - Java Beginners
String program  write a program to accept a word. Pass it to the function magic(String x). The function checks the string for the presence... prints it is a magic string otherwise it prints not a magic string.  
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
write a program to create an arraylist with string(add,remove) operation.and value should be enter through keyboard.
write a program to create an arraylist with string(add,remove) operation.and value should be enter through keyboard.  write a program to create an arraylist with string(add,remove) operation.and value should be enter through
write a program to create an vector with string(add,remove) operation.and value should be enter through keyboard.
write a program to create an vector with string(add,remove) operation.and value should be enter through keyboard.  write a program to create an vector with string(add,remove) operation.and value should be enter through keyboard
write a program to create an arraylist with string(add,remove) operation.and value should be enter through keyboard.
write a program to create an arraylist with string(add,remove) operation.and value should be enter through keyboard.  write a program to create an arraylist with string(add,remove) operation.and value should be enter through
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
want a program for cd writing in java - Java Beginners
want a program for cd writing in java  Hi Can u tell some body, doing a program on cd writing in java. I m facing some problem on it. Thanks in advance. Regards sanjaya
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
String reverse program
String reverse program  write a java program for reverse string? if the string is "Hi welcome to hyderabad" the reverse string is "hyderabad to welcome Hi"   I hope you would have applied your logic before asking
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
ModuleNotFoundError: No module named 'will-i-am'
ModuleNotFoundError: No module named 'will-i-am'  Hi, My Python... 'will-i-am' How to remove the ModuleNotFoundError: No module named 'will-i... have to install padas library. You can install will-i-am python with following
Which java can i download?
Which java can i download?  Hello, i'm a beginner on java. Which java can i download for to exercise with my codes? Thanks in advance.   ... a window, which want me to insert this "Cartdrige". But no file was open, what can i
I am getting this exception
I am getting this exception   Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java
without writing web.xml file we can write servlet program
without writing web.xml file we can write servlet program  Sir Morning... Sir I have one Question "without writing web.xml file we can write servlet program". if yes which way? if no why? but without use Annotation........ Plz
i need program or code for this program
i need program or code for this program  out should be in this form 1 2 3 4 5 6 3 5 7 9 11 8 12 16 20 20 28 36 48 64 112
java string vowel program
java string vowel program  java string vowel program   Please visit the following links: Display the word that begins with vowel Java Count Vowels
java program for string tokenzing and parsing
java program for string tokenzing and parsing  String s="height=128 weight=22 gender=male"; i need to convert this into height="128" weight="22...\" "); But how to add double quotes
java program for string tokenzing and parsing
java program for string tokenzing and parsing  String s="height=128 weight=22 gender=male"; i need to convert this into height="128" weight="22...\" "); But how to add double quotes
String Function Program
String Function Program  The string function program is just an application of the string manipulation functions in JAVA. The program is designed to count the number of one-letter word, two-letter word, and three-letter words
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 to swap the string
Program to swap the string  Hi, can any one tell me the code to swap...!!   Here is an example that prompts the user to enter two string and then swaps both the string without using third variable. import java.util.*; class
java program for writing xml file - Java Beginners
java program for writing xml file  Good morning i want to write values from my database(one table)into one xml file. Like i have 3 coloumns in my table along with their values,so when click some button i need to generate one
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
need help on writing a program. - Java Beginners
Writing first Java Program  Hi, I need help to write my first Java Program other then Hello World! Thanks!!  Hi Thanks for choosing roseIndia to get your query solved. check given link to see the solution of your Java
Which programming languages should I learn in 2021
Which programming languages should I learn in 2021  Hi, I am fast... = window.adsbygoogle || []).push({}); Which programming languages should I learn... languages to learn. So I need help in selection of languages to learn in 2021. Can
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
:( I am not getting Problem (RMI)
I am not getting Problem (RMI)  When i am excuting RMI EXAMPLE 3,2 I am getting error daying nested exception and Connect Exception  
A Program To Reverse Words In String in Java
A Program To Reverse Words In String in Java  A Program To Reverse Words In String in Java for example: Input:- Computer Software Output... Tell Me This Program.  Here is an example that reverse the words

Ads