Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8956789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:51:14+00:00 2026-06-15T14:51:14+00:00

I have a function which should accept date in a format DD-MON-YY and should

  • 0

I have a function which should accept date in a format DD-MON-YY and should display in the format DD-MM-YYYY. The function I have created is :

create or replace function PRINT_IT(abc date)
RETURN DATE
IS
  v_date DATE;
BEGIN
  if regexp_like(abc,'^[0-9]{2}-[a-z]{3}-[0-9]{2}$')
  then
    v_date := TO_DATE(abc,'DD-MM-YYYY');
  else
    dbms_output.put_line('wrong format');
  end if;
  dbms_output.put_line('The date is ');
  return v_date;
END PRINT_IT;

but the value returned is always wrong date format!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:51:15+00:00Added an answer on June 15, 2026 at 2:51 pm

    No, it’s not. Your date is being output in the format specified by your NLS_DATE_FORMAT. I you want to display if differently then change this parameter for your session:

    alter session set nls_date_format = 'dd-mm-yyyy'
    

    Note the word display. That’s all this does. That’s all you should consider doing. The way a date is displayed in no way effects the way it is stored.

    More normally you might use TO_CHAR() with an appropriate format model to display a date, i.e. to_char(my_date, 'dd-mm-yyyy'). It will no longer be a date but a character.

    It doesn’t look like you want to display a date as you’ve said. You’re returning the value from your function, in which case I would stick with what you have. You only need to transform a date into an appropriate format for display when taking it out of the database, always store it as a date in the database. This in turn means that it doesn’t matter what it looks like when stored in the database, merely that it is actually a date.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function to create a pdf which should return bitarray. Below is
I have a function: def create(sender, **kw): [...] Which should be called when the
Can I´m asking for advice. I have function which should return javascript object function
I have a JTable inside a JScrollPane. After calling my function which should populate
i have function, which has to accept two types of data - Observable collection
Let's suppose I want to create a javascript class/object/function which have a method that
I have an Agent which should accept Post parameters, sent from An App in
I have a javascript function which should populate a select box with all items
hi i have function which is called by tinker listbox so i cannot return
I have a function which looks something like this, it returns a noncopyable class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.