java conversion



Share on Google+Share on Google+

java conversion
2 Answer(s)      5 years ago
Posted in : Java Beginners

how do i convert String date="Aug 31, 2012 19:23:17.907339000 IST" to long value

View Answers

October 31, 2012 at 11:32 AM

Here is a code that converts string date to long.

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class ConvertStringDateToLong {
  public static void main(String[] args) throws Exception {
    String today = "Aug 31, 2012 19:23:17.907339000 IST";

    DateFormat formatter = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.S z");
    Date date = formatter.parse(today);
    long dateInLong = date.getTime();

    System.out.println("date = " + date);
    System.out.println("dateInLong = " + dateInLong);

October 31, 2012 at 7:17 PM

Thank you for your post. The output dateInLong gives millisecond but i want nanosecond long value for the exact date "Aug 31, 2012 19:23:17.907339000 IST" how can i do..?


Related Tutorials/Questions & Answers:
java conversion
java conversion  how do i convert String date="Aug 31, 2012 19:23:17.907339000 IST" to long value
object conversion - Java Beginners
/java-conversion/ObjectToDouble.shtml Thanks... sandeep kumar suman...object conversion   Hi, Can anybody tell me the object conversion in java.   Hi sandeep Can u please tell me in details about your
Java Conversion Question - Java Beginners
Java Conversion Question   Hello sir ,How i can Convert Java Code to ,Plz Help Me
hexadecimal conversion java compilation - UML
hexadecimal conversion java compilation  write a simple program..., Please visit the following links:
Distance conversion - Java Beginners
Distance conversion  Write an application that reads a distance in metres. The program will then present a user menu of conversion types, converting the distance to kilometres, feet and inches, according to the user?s selection
form to java script conversion
form to java script conversion  I am using a form one more form cotain a piece of code . how to convert it to java script to function it properly..." name="ie" value="UTF-8" /> <input type="text" name="q" size="55" />
Excel conversion tool. - Java Beginners
Excel conversion tool.  Hi, I need a conversion tool which can convert .xls(Excel 2003) to .xlsx (Excel 2007) and vice-versa. Please suggest any links ro tools. Thank You
Java To Vb.Net Conversion - Java Beginners
Java To Vb.Net Conversion  How to convert Java Code To,which Software is useful to convert java to,plz Help Me
String to Date Conversion - Java Beginners
)); For read more information :  Hi friend, For conversion in this format : 11/SEP/2008 07:07:32
Another distance conversion - Java Beginners
a method for each conversion ? toKilometres(), toFeet(), and toInches
Conversion In Collections - Java Interview Questions
Conversion In Collections  Hi Friends, can u give code to convert ArrayList to HashMap and HashMap to ArrayList. Thanks Prakash  Hi Friend, 1)Convert ArrayList To HashMap: import*; import java.util.
PDF to Word Conversion - Java Beginners
PDF to Word Conversion  Hello, Can we convert a PDF document to Microsoft word document thru Java. If its not possible in Java, is it possible in any other language
Java Date conversion - Date Calendar
Java Date conversion  How do I convert 'Mon Mar 28 00:00:00 IST 1983' which is a java.util.Date or String to yyyy/MM/dd date format in sql
Conversion from color to Gray Image - Java Beginners
Conversion from color to Gray Image  Hi... Sakthi here.. i am new to java. and i haven't try this so far How to convert the color image to gray scale image in java? could u plz help me out to start the process
java code for conversion of arraylist to string - Development process
java code for conversion of arraylist to string  Hi, i have an arraylist contains [a,b,value,c,d,value]when ever value comes it will split into that i want to convert into string, after that split the string
Java Date Conversion
Java Date Conversion In java date conversion, two packages are used... seconds and even then only Java provides implementation that actually track leap... Java Converts String into Date In this example we are going to convert
Java code for conversion between .xls and .xlsx or vice versa - Development process
Java code for conversion between .xls and .xlsx or vice versa  I've some problems in my Project. I'm working on a web based application which... or tool in Java for converting between .xls to .xlsx or Vice versa
image conversion tools
image conversion tools  how many tools are available in image conversion at particularlly in java
conversion Applet
conversion Applet  I am a java beginner.................. strong texthow to create JApplet that prompts the user to enter a distance in miles in a JTextField and then converts mile to kilometers and display the result as XX.XX
currency conversion
currency conversion   hi frds.. I wan jsp code to convert currency in different formats??... if u know plz plz plz post it   Please visit the following link:
Conversion - Development process
Conversion  Why is there a need to convert from Java to .NET? What is the theory of conversion from java to .NET? How it is done?   Hi... Conversion Assistant (JLCA). Code that calls Java APIs can convert to comparable C# code
html2xml conversion
html2xml conversion  java code to convert html file to xml
Language Conversion
Language Conversion  write a java program to convert "Hello World" in spanish
Number conversion in JavaScript
Number conversion in JavaScript  How do you convert numbers between different bases in JavaScript
conversion of language in a project
conversion of language in a project  how can we convert the database code in the project dynamically
.wav file conversion
.wav file conversion   how to read .wav file and converd the data into text format
NSString to float conversion
NSString to float conversion  HI, I my iPhone and iPad application I have to convert NSString to float. Provide me example of NSString to float conversion. Thanks   Hi, Please see NSString to float conversion


Advertisement null