Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting datetime based on a condition

Status
Not open for further replies.

elsenorjose

Technical User
Oct 29, 2003
684
US
Hello,

I've looked for this exact problem and I might be missing something but I didn't find a solution for my problem. My apologies if it has been answered.

I have an Oracle date time field that I need to convert to display differently based on a condition. Sometimes, 'dummy' dates are entered in a system if we receive only the Month and Year, so the user will enter 12/01/2011. Other times, we will have the full date, such as 12/23/2011. If the user enters the 'dummy' date, there is another field they have to select that instructs us to show the value in Mmm yyyy format, otherwise, the full date in dd-Mmm-yyyy format (note the dashes in the second but not the first). I've tried all kinds of ToText Cstr conversions, but it's not quite working. This is what I am currently using:

Code:
If {LOT.X_SHOW_DOM} = 'No' Then ToText(Cdate({X_COA.PRODUCTION_DATE}),"Mmm yyyy")
Else ToText(Cdate({X_COA.PRODUCTION_DATE}),"Mmm-dd-yyyy")

But the value I am getting is 12mm 2011 for the first example above.

Can someone help me fill in the missing piece? I'm using CRXI on Oracle, I believe, 9i.

Thank you.
 
The case DOES matter--you need to use "MMM", not "Mmm".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top