Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Posts
    13

    Unanswered: How to convert month string into date

    I want to take a string representation of month and convert it to a date format.

    For example:
    'July' -> '2007-07-01 00:00:00.0'

    Thanks

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    You will have to write your own UDF.

    Andy

  3. #3
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Suppose your string repr. of month name is in "month_name"; then
    Code:
    VALUES(
     CASE month_name
      WHEN 'July' THEN DATE('2007-07-01')
      WHEN 'January' THEN ...
      WHEN ...
      ...
      ELSE CAST(NULL AS DATE)
     END)
    Last edited by Peter.Vanroose; 10-14-07 at 15:33.
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

Posting Permissions

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