Re: how to convert JAVA string in "hh:mm dd/mm/yyyy" to sql datetime format?



shivaraj wrote:
On Mar 19, 4:53 pm, Arne Vajhøj <a...@xxxxxxxxxx> wrote:
[SNIP]
Ian,
by mistakly I said it as ""hh:mm dd/mm/yyyy" but it is ""hh:mm
mm/dd/yyyy" format. I will try splitting that string into date and
time and try to use it as sql date format.
Arne,
To try with this approach, I am not getting any patterns in
"hh:mm mm/dd/yyyy" in SimpleDateFormat to convert it into java date
format. If that is the case again I have to split it as Ian said. Is
that so or am i missing something?

You should read the Javadoc for java.text.SimpleDateFormat more carefully.

Lowercase 'm' denotes minutes in an hour, whereas uppercase 'M' denotes months in a year. You cannot assume that you can use 'm' for both month and minute.

You also need to beware of the distinction between 'h' and 'H' for the hour. Both are valid, but they will yield different results.

Attention to detail is vital.

David Harper
Cambridge, England
.



Relevant Pages

  • Re: Moving a VBA function to SQL server
    ... SQL is a set-based language. ... "String Functions " in Books Online. ... This will produce a job header formatted like this: ... The format he specifies is stored in table 'Settings' - field 'JobHdrMask' ...
    (comp.databases.ms-access)
  • Re: ADP ignoring my format code
    ... we're talking VBA, not SQL, then all we need is Month. ... what the original poster wanted was a string ... representation of a complete date in US format. ... "Vadim Rapp" wrote in message ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Storing Doubles in SQL
    ... Also it's pointless to format the value before storing it. ... Dave Patrick ....Please no email replies - reply in newsgroup. ... string and format as in: ... >I can successfully read and write from/to sql using excel macros. ...
    (microsoft.public.excel.programming)
  • Re: Searching on DATETIME Fields
    ... So First try quoting the string, then ensure that the format of the date ... Wayne Snyder, MCDBA, SQL Server MVP ... >>> The field I am querying is of DATETIME data type, ...
    (microsoft.public.sqlserver.server)
  • Re: simple query not so simple
    ... If that is truly your SQL statement, you have just asked to find all ... In Oracle all dates contain 'century, year, month, date, hour, minute, ... string - if you can read it, it's a string, not a date - so use string ... either implicitly (if your string is in the session's date format) ...
    (comp.databases.oracle.misc)