Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

I am writing a program which converts a string to a timestamp and add days to it

Ads

 
 

Share on Google+Share on Google+

Arun Krishna
I am writing a program which converts a string to a timestamp and add days to it
0 Answer(s)      5 years and 7 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.

Ads
View Answers
Ads









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?
is the full code of the program to convert Date String format to Timestamp... * Example of Converting String date * into timestamp from a Java program...String Date to Timestamp example in Java Java is programming language
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
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
Mysql Date Add Days
:-Date From which you want to add days. INTERVAL expr unit:- Number of the days... Mysql Date Add Days       The Tutorial illustrate an example to add days to the particular
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
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
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
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
:( 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  
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
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
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
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  write a program to print the pattern p r o program r a m
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
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
i am Getting Some errors in Struts - Struts
i am Getting Some errors in Struts   I am Learning Struts Basics,I am Trying examples do in this Site Examples.i am getting lot of errors.Please Help me
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
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
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
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
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
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
i am getting multiple values in listbox
i am getting multiple values in listbox   hi sir, i am using... table group by stuname) order by a.name in a subquery multiple recdates i am getting its working fine, but in main query also i am getting multiple name
string program
string program  wap to find single occurrence of given string in java without using any predefined method
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