Java Date Convert

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
whitewater4562000
Posts: 66
Joined: Sat Aug 23, 2008 4:22 pm UTC
Location: Scotland
Contact:

Java Date Convert

Postby whitewater4562000 » Thu Sep 12, 2013 3:23 pm UTC

Hi,

I would like to convert an entered string (uk date format i.e. dd/mm/yyyy) to MySQL date format (yyyy/mm/dd).
From what I read online it seems SimpleDateFormat is the way to go, this seems to fine (sort of) if entered in US format but not UK format.

Can anyone help.

Note: The entered date will not be the current date as it is for future traveling dates.

Many Thanks

User avatar
Pesto
Posts: 737
Joined: Wed Sep 05, 2007 5:33 pm UTC
Location: Berkeley, CA

Re: Java Date Convert

Postby Pesto » Thu Sep 12, 2013 5:19 pm UTC

SimpleDateFormat will work for any date format you can imagine. It parses the date based on a format string that you give it. Off the top of my head, the format string for a UK date would be "dd/MM/yyyy".


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 6 guests