Jake
Jake

Reputation: 2917

convert string, with day of week to timestamp

Are there any ways to convert "Wed, 30 Nov 2011 09:13:00" to a timestamp besides programatically coding it yourself? Like any libraries/functions that can help accomplish this?

thanks

Upvotes: 0

Views: 617

Answers (4)

vextorspace
vextorspace

Reputation: 934

Something like:

String dateStr = "Wed, 30 Nov 2011 09:13:00"; DateFormat formatter = new SimpleDateFormat("EEE, d MMMMM yyyy HH:mm:ss");

formatter.parse(dateStr);

Upvotes: 0

Use JODA Time. It has format building capabilities for parsing dates and time.

Upvotes: 0

yegor256
yegor256

Reputation: 105203

Try JodaTime, more powerful and flexible than JDK

Upvotes: -1

soulcheck
soulcheck

Reputation: 36777

SimpleDateFormat is your friend in this case

Remember that Date.getTime() returns miliseconds since the beginning of unix time.

Upvotes: 2

Related Questions