Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: How to get unix timestamp from formatted date?

  1. #1
    Junior Member
    Join Date
    Oct 2010
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to get unix timestamp from formatted date?

    Hello!
    I am using Twitter API and it returns the date in this format:
    Wed Jul 08 10:38:06 +0000 2009

    I need to store the date as unix timestamp. How can I convert this formatted date to a unix timestamp?
    Is there a class in Java that can do this?

    Thanks.


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: How to get unix timestamp from formatted date?

    Hello snytkine,

    I've been reading up on this - Unix time - Wikipedia, the free encyclopedia

    Which part of the above date String do you need to generate the time stamp? It's the Month, Day, Year & Time right? We can forget the Wed and +0000?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  3. #3
    Junior Member
    Join Date
    Oct 2010
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to get unix timestamp from formatted date?

    Sure, we can forget about Wed and I am not sure about +0000, it's probably GMC offset, we should not forget about GMC offset.

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: How to get unix timestamp from formatted date?

    Quote Originally Posted by snytkine View Post
    Sure, we can forget about Wed and I am not sure about +0000, it's probably GMC offset, we should not forget about GMC offset.
    Do you mean GMT offset?

    I'm looking into this now...
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  5. #5
    Junior Member
    Join Date
    Oct 2010
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to get unix timestamp from formatted date?

    Yes, GMT offset

  6. #6
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: How to get unix timestamp from formatted date?

    Have you started writing any code yet?

    These links should help:

    4WebHelp - Online Tools: Unix Timestamp Converter

    Epoch Converter - Unix Timestamp Converter

    I'm playing with it and i'll post back soon
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

Similar Threads

  1. sql date problem
    By realosso in forum JDBC & Databases
    Replies: 2
    Last Post: June 3rd, 2010, 09:32 AM
  2. a litle help on how to convert date to day
    By george in forum Algorithms & Recursion
    Replies: 6
    Last Post: March 18th, 2010, 07:18 PM
  3. [SOLVED] how to get each field of a current date
    By chronoz13 in forum Java Theory & Questions
    Replies: 4
    Last Post: January 24th, 2010, 06:33 AM
  4. How to set expiry date for cms?
    By khodam in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: December 4th, 2009, 01:15 PM
  5. How to Get the current date and time
    By JavaPF in forum Java Programming Tutorials
    Replies: 2
    Last Post: December 2nd, 2008, 01:55 PM

Tags for this Thread