Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Posts
    50

    Unanswered: Extracting day and month from a date value

    HI! How can I extract the month and the day from a date? Can I use the trunc() function for that?

    Thank you.
    Ah! Não ser eu toda a gente e toda a parte!

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    use TO_CHAR with desired mask.

  3. #3
    Join Date
    Dec 2003
    Posts
    50
    Thanks! Precious help!

    For future reference, here is the SQL to check who's anniversary is today:

    Code:
    SELECT name FROM Person WHERE
    TO _CHAR(bDate,'MM')=TO_CHAR(SYSDATE,'MM') AND
    TO_CHAR(bdate,'DD')=TO_CHAR(SYSDATE,'DD') AND dDate IS NULL
    bDate - born date
    dDate - death date
    Last edited by rpOliveira; 01-20-04 at 12:21.
    Ah! Não ser eu toda a gente e toda a parte!

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    SELECT name FROM Person
    WHERE TO _CHAR(bDate,'MM-DD')=TO_CHAR(SYSDATE,'MM-DD')
    AND dDate IS NULL

  5. #5
    Join Date
    Dec 2003
    Posts
    50
    Yes - simpler !!!
    Ah! Não ser eu toda a gente e toda a parte!

Posting Permissions

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