Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393

    Unanswered: Nb Months between 2 dates (one in DB2 format)

    How can I get the number of months (or years or days...)
    between the current_timestamp
    an a date in the DB2 format ?

    DateDB2 Char(26) = 2000-12-30-12.55.30.123456
    DateSQL = GetDate() or Current_Timestamp

  2. #2
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    datediff (mm,convert (datetime , substring(datedb2,1,10)),DateSQL )
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  3. #3
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393
    nope,

    I've tried that sort of conversion but it seems
    that the CONVERT(DateTime,...) function inverts
    the month and the day

    Convert(DateTime,'2000-12-30') >>> doesn't work !!!
    Convert(DateTime,'2000-30-12') >>> works !!!


    Is '2000-30-12' a standard English-Format-Date ???

  4. #4
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    Convert(DateTime,'2000-12-30') >>> doesn't work !!!
    Then try this >>> select Convert(DateTime,'2000-12-30',120)
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  5. #5
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393
    Thank you very much Enigma !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •