Checking for month boundaries given a date
Hello everyone,
Given a date, I have to check whether a date is the 1st or last in the month, I have some views of doing it ,but looking for the best and efficient method to start with.
Replies are greatly apprecaited.
Thanks,
Greeshma.
Hi,
Many of Oracle's date functions allow a parameter where you can override the current NLS settings only for that function call.
For example:
SELECT TO_DATE ( 'JUIL.'
, 'MON'
, 'NLS_DATE_LANGUAGE=FRENCH'
) AS month
FROM DUAL;You could also create your own table of month names
NAME NUM LANGUAGE
JANVIER 1 FRENCH
JANV 1 FRENCHand look up the names in this table, rather than in a string hard-coded in the function. This might be especially useful if you wanted to allow your own abbreviations or spellings (e.g., ignoring accent marks).
Edited by: Frank Kulash on Dec 16, 2010 11:40 PM
Similar Messages
-
Tables/FM for opening/closing stock for material on given posting date
Hi All,
I had requirement of find the opening/closing stock for material on given posting date. The values we can find out using TCode - MB5B.
But I cannt use MB5B to extract data because I need to find detials for thousands of material.
Can you please adivce if their is any FM or tables through which i can find this detial on any given date apart from current date.
Thanks & Regards,Hi,
[https://forums.sdn.sap.com/click.jspa?searchID=19631709&messageID=6593903]
[https://forums.sdn.sap.com/click.jspa?searchID=19631709&messageID=6630975] -
X-axis labels for months when listing daily data
Hi all,
Have a problem with the presentation of a chart that I need some assistance with, can anyone advise.
OBIEE 10.1.3.4.1
I have a chart that is display data along the x-axis for a rolling year, however the selection is excluding weekends. On the date column I have a custom format of MMM-yyyy to produce the months and get 12 labels, however it will often skip one month and duplicate another. So for example I'm currently getting:
Mar-2010, Mar-2010, May-2010, Jun-2010, etc.....
Mar-2010 is shown twice and Apr-2010 is missing.
I appreciatre this is because I'm missing off the weekends, it sometime coincides that a given month has far less days shown.
Can anyone suggest a soilution to get the 12 months listed as the actual 12months rather then some duplicates/missing?
Thanks for any assistance.Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with you directly:
http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=11522300?resid=-Z5tUwoHAiwAAA8@NLgAAAAS&rests=1254701640551 -
Checking for month name and number in different language?
I have to let people search for documents by date. The database is used by French-speakers as well as English-speakers. The search allows users to type in free text (because it's not just dates they might search by, though if they do type in something that's intended to be interpreted as a date, that's the only thing they're allowed to type in). So, I might get '23/Apr/2009' or '2009/04/23', for example. (I also have to allow them to submit 23.04.2009 and 23 04 2009 and any combination of the above!)
I have written a function which breaks the string into three bits, and then I work out if each bit is a year, or a month, or a day with simple rules (eg, if it's a number between 1900 and 2400, it must be the year component).
When it comes to the month, I do two things. One is obvious: is it a number between 1 and 12? The other is, is it a month name that appears in a list of 'allowed' month names. So my function does this at the start:
v_validmonths := 'january,february,march,april <and so on>';
v_validmonths := v_validmonths || ',janv,fevr,avr,mai, <and so on>';Then I do this:
for x in 1 .. listlen(v_validmonths,',') loop
v_probemonth := listgetat(v_validmonths,x,',');
if instr(lower(v_partone),v_probemonth) > 0 then
v_month := extract (month from to_date(v_partone,'MON'));
end if;
end loop; IE, I compare the first component of the string (v_partone) with the list of allowed month names. I repeat that for the other two parts of the supplied string. As you can see, if one of the parts of the supplied string matches an allowed month name, I then try to extract the month number into a variable, using Oracle's own extract function.
And that's where my problem arises. Because although "aout" is valid French for August and is permitted by my list of valid months, the extract function fails to understand it. A simple select extract (month from to_date('AOUT','MON')) from dual, for example, gives an ORA01843 (invalid month).
How can I get the code to work with French (and German, actually) months and month abbreviations whilst also being able to understand English ones? Is there an in-built function that would allow me to do this? Or is there some way neatly to say, 'yes: AOUT is in the list, and it's month 8' without me having to rely on the extract function to work it out?
(I realise that the business requirement here is very peculiar and your first reaction will probably be "this is horrible!". I will absolutely agree with you! But this is the requirement as has been explicitly specified by the MD and I can't negotiate it away, sadly.)Hi,
Many of Oracle's date functions allow a parameter where you can override the current NLS settings only for that function call.
For example:
SELECT TO_DATE ( 'JUIL.'
, 'MON'
, 'NLS_DATE_LANGUAGE=FRENCH'
) AS month
FROM DUAL;You could also create your own table of month names
NAME NUM LANGUAGE
JANVIER 1 FRENCH
JANV 1 FRENCHand look up the names in this table, rather than in a string hard-coded in the function. This might be especially useful if you wanted to allow your own abbreviations or spellings (e.g., ignoring accent marks).
Edited by: Frank Kulash on Dec 16, 2010 11:40 PM -
Using Adobe Acrobat Pro XI and Excel 14.3.8 on a mac.
Saved PDF as "optimized PDF" then "save as other" > spreadsheet > Microsoft Excel Workbook.
Problem: numbers in some random dates are transposed so that month and day are reversed. No particular pattern to these errors. Only fix we've found is to go through and manually check and correct the date errors - there are hundreds of these errors in the document so this is not a good solution.
(Note: Excel columns with dates are specified as "date" fields. All dates are formatted as m/d/yy)
Any ideas what's causing this problem problem and how to fix it?
Thanks in advance![discussion moved to Creating, Editing & Exporting PDFs forum]
-
Pre-checks for changing some material master data
Hi,
Are there any pre checks (ie. no open documents) needed when changing the following items via MM17:
1. Storage Location
2. Account Assignment Group
3. Transportation Group
4. Purchasing Value Key
5. MRP Group
6. Scheduling Margin Key
The materials have existing purchase orders and some have sales orders. Will there be any impact when the data are changed? Thanks.Hi,
You can not change the storage location for a material.but you can extend the material to another storage location.
other changes will not have effect on existing docs.
Try MEMASSPO to update open PO's with new storage location.Select EKPO and add storage location in selection fields.
Best Regards,
Raj -
Query for month start and end date
Hi,
I want to pick every month Start date and End Date. could anybody suggest what is the query for this.
I need output
Start Date End Date
01/01/2011 31/01/2011
01/02/2011 28/02/2011
01/03/2011 31/03/2011
01/04/2011 30/04/2011
01/05/2011 .......Hi,
SQL> select sysdate from dual;
SYSDATE
24-FEB-11
SQL> select last_day(sysdate) from dual;
LAST_DAY(
28-FEB-11
SQL> select last_day(sysdate),last_day(add_months(sysdate,-1))+1 from dual;
LAST_DAY( LAST_DAY(
28-FEB-11 01-FEB-11
SQL> select last_day(sysdate),last_day(add_months(sysdate,-2))+1 from dual;
LAST_DAY( LAST_DAY(
28-FEB-11 01-JAN-11Try to refer to Oracle documentation and try to experiments the functions, you will get results on your hand.
- Pavan Kumar N
Edited by: Pavan Kumar on Feb 24, 2011 12:51 PM
Edited by: Pavan Kumar on Feb 24, 2011 12:52 PM -
Set up alarm for monthly recurrance and especific dates
good morning,
anyone knows how do I set up a monthly recurring alarm in the clock? Also, can I set an alarm with an especific date?, how do I set up a monthly recurring alarm in the clock? Also, can I set an alarm with an especific date?
thanks,It's an alarm clock, not a calendar. You can set alarms to repeat on various days of the week. You can't set it to recur monthly or on a specific date. For that, you'd need to use an alert in the calendar.
It's possible that there are alarm apps in the App Store that will do what you want. You'll need to do some searching.
Best of luck. -
Need To Check For Nulls And Force A Date
I'm trying to check to see if a field is blank (null or blank), if so, force a date into it. My formula is giving me zeros. What is wrong with the below formula ?
If {Sales_Primary.Type_Of_Sale} = 1 And
Isnull() Then 1999-01-01My bad. I don't think Date Time fields have "empty strings" but rather 0's instead.
Try replacing the ="" with =0
If {Sales_Primary.Type_Of_Sale} = 1 And
(Isnull({TableName.Sales_Date}) OR {TableName.Sales_Date} = 0) Then #1/1/1999#
Or you could simply try it without the "OR {TableName.Sales_Date} = 0" and see what you get.
If {Sales_Primary.Type_Of_Sale} = 1 And
Isnull({TableName.Sales_Date}) Then #1/1/1999#
Jason -
How can I enforce automatic spell checking for selected fields of data entered by form users?
I'd like to be able to enforce spell checking of selected fields in the forms that I've created using LiveCycle Designer 8.2 at run time, as opposed to design time. I understand the version LCD 8 has a nifty new spell checker for form designers. But I want to spell check the data entered by users using Acrobat Reader. And I want to enforce the spell checking automatically on selected fields only.
Presently it seems that users filling in my forms, must know how to manually right-click on each field and select "Spell Check" from the resulting dialog box in order to check for spelling errors in the data the user has entered in the form.
I would like to discover a way to enforce spell checking in selected fields, just as I am able to do in forms created using Acrobat Pro. In Acrobat Pro, I can set a property for each field to require spell checking. but that feature seems to be missing in Livecycle Designer.
I've check the Object model for XFA forms hoping that I might find a method I can call with a Javascript, to check spelling based on an event such as onBlur. But I haven't found a spell check method.
Am I missing something simple? Is there a way to set each field to be spell checked when a user is filling in the form using the free Acrobat Reader?
Our users are not sophisticated and requiring them to spell check each field separately just won't cut it...
Any help on this will be greatly appreciated.
Thanks!
-David BartholomewHi David,
Two things...
At design time set the locale of the form to one that Acrobat spell checks. For example English (US) and English (UK) locales have spell checkers; however English (Ireland) does not. Check the Warnings tab to see if spell checking is supported for your locale.
If your form locale supports spell checking then you can go to the button script below.
If you form locale does NOT support spell checking then Stephanie has a great work around to force spell checking (http://forums.adobe.com/message/2233945#2233945).
Bring a regular button onto the form and in the click event have the following:
app.execMenuItem("Spelling:Check Spelling");
Which will open the spell checker for all fields. Thanks to Paul for extracting all of the accessible menu items (http://forums.adobe.com/message/1912914#1912914).
Good luck,
Niall -
Checking for files in a folder -- Wrong output
Hi guys,
I'm writing a simple program, I have to check for 6 files (hardcoded, they will never change) if they are in certain directories/paths.
The problem is, I think I have a problem in my IF statements, because it continueally returns false.
The paths are on networked drives, does that make a difference?
I'm rather stuck on this one, any help would be appreaciated.
(some paths/file names have been replaced by "xxxxxxxxx", for security)
* Checks for files in a directory, prints results.
* @author Mitchell
* @version 0.2
* @date 28 Jul '05
import java.awt.*;
import java.io.*;
import java.lang.Object;
import javax.swing.*;
import java.util.*;
public class FileCheck extends JFrame
//declare filenames/paths, add more if needed.
String fileName1 = "file it2_load.txt";
String fileName2 = "mo_batch.txt";
String fileName3 = "mo_bcp.txt";
String fileName4 = "mo_load.txt";
String fileNameX = "IT2_1000_yyyymmdd.txt";
String fileNameY = "IT2_2000_yyyymmdd.txt";
//declare directories to search
String fileLocation1 = "\\\\xxxxxxxxx\\aus_bear\\Patrol";
String fileLocation2 = "\\\\xxxxxxxxx\\nz_bear\\Patrol";
String fileLocation3 = "\\\\xxxxxxxxx\\bear\\remote\\RTS";
String fileLocation4 = "\\\\xxxxxxxxx\\bear\\remote\\RTS";
//declares array for filename storage. Change if needed.
File fileNamesArray1[];
File fileNamesArray2[];
File fileNamesArray3[];
File fileNamesArray4[];
//set path to find files
File filePath1 = new File(fileLocation1);
File filePath2 = new File(fileLocation2);
File filePath3 = new File(fileLocation2);
File filePath4 = new File(fileLocation2);
//string buffer to store results
StringBuffer results = new StringBuffer();
//start of FileCheck method
public FileCheck()
//collects all filenames from pre-set path1
fileNamesArray1 = filePath1.listFiles();
results.append("This program checks for files in given folders."
+"\nTRUE = File does exist in folder."
+"\nFALSE = File does not exist in folder.\n\n");
results.append(fileLocation1 + "\n");
//start for loop1 - check for pre-set filenames in path1
for(int i=0; i < fileNamesArray1.length; i++)
if( fileName1.equals(fileNamesArray1.toString()))
results.append("PATH1 >> " + fileNamesArray1[i] + " >> TRUE\n" + fileNamesArray1[i].lastModified());
else if( fileName2.equals(fileNamesArray1[i].toString()))
results.append("PATH1 >> " + fileNamesArray1[i] + " >> TRUE\n" + fileNamesArray1[i].lastModified());
else if( fileName3.equals(fileNamesArray1[i].toString()))
results.append("PATH1 >> " + fileNamesArray1[i] + " >> TRUE\n" + fileNamesArray1[i].lastModified());
else if( fileName4.equals(fileNamesArray1[i].toString()))
results.append("PATH1 >> " + fileNamesArray1[i] + " >> TRUE\n" + fileNamesArray1[i].lastModified());
else
results.append("PATH1 >> " + fileNamesArray1[i] + " >> FALSE\n");
} //end for loop1
//collects all filenames from pre-set path2
fileNamesArray2 = filePath2.listFiles();
results.append("\n" + fileLocation2 + "\n");
//start for loop2 - check for pre-set filenames in path2
for(int j=0; j < fileNamesArray2.length; j++)
if( fileName2.equals(fileNamesArray2[j].toString()))
results.append("PATH2 >> " + fileNamesArray2[j] + " >> TRUE\n" + fileNamesArray2[j].lastModified());
else if( fileName2.equals(fileNamesArray2[j].toString()))
results.append("PATH2 >> " + fileNamesArray2[j] + " >> TRUE\n" + fileNamesArray2[j].lastModified());
else if( fileName3.equals(fileNamesArray1[j].toString()))
results.append("PATH2 >> " + fileNamesArray2[j] + " >> TRUE\n" + fileNamesArray2[j].lastModified());
else if( fileName4.equals(fileNamesArray1[j].toString()))
results.append("PATH2 >> " + fileNamesArray2[j] + " >> TRUE\n" + fileNamesArray2[j].lastModified());
else
results.append("PATH2 >> " + fileNamesArray2[j] + " >> FALSE\n");
} //end for loop2
//collects all filenames from pre-set path1
fileNamesArray3 = filePath3.listFiles();
results.append("\n" + fileLocation3 + "\n");
//start for loop3 - check for pre-set filenames in path1
for(int k=0; k < fileNamesArray3.length; k++)
if( fileNameX.equals(fileNamesArray3[k].toString()))
results.append("PATH3 >> " + fileNamesArray3[k] + " >> TRUE\n" + fileNamesArray3[k].lastModified());
else
results.append("PATH3 >> " + fileNamesArray3[k] + " >> FALSE\n");
} //end for loop3
//collects all filenames from pre-set path4
fileNamesArray4 = filePath3.listFiles();
results.append("\n" + fileLocation4 + "\n");
//start for loop4 - check for pre-set filenames in path1
for(int l=0; l < fileNamesArray4.length; l++)
if( fileNameY.equals(fileNamesArray4[l].toString()))
results.append("PATH4 >> " + fileNamesArray4[l] + " >> TRUE\n" + fileNamesArray4[l].lastModified());
else
results.append("PATH4 >> " + fileNamesArray4[l] + " >> FALSE\n");
} //end for loop4
//construct displaybox for results
JTextArea textArea = new JTextArea( results.toString() );
textArea.setEditable(false); //disables modification of results
Container container = getContentPane();
container.add( new JScrollPane( textArea ) );
setSize( 500, 500 ); // set window size
setVisible( true ); //allow visibility
//main
public static void main (String args[])
FileCheck window = new FileCheck();You could try using the File.exists() method.
The paths are on networked drives, does that make a difference?Try the above on a local file and a networked file.
I'm writing a simple program, Actually a simple program would be something like:
File file = new File("xxx");
System.out.println(file.exists());No need to include all the code you posted.
http://www.physci.org/codes/sscce.jsp -
Duplicate check for non inventory vendor invoices in Finance
Hi,
SAP provides duplicate check for non inventory vendor invoices posted through transactions F-43 and FB01 etc. The field values checked for duplicate invoice include Document date and Reference field.
I want to know, is there any flexibility of removing Document date from checking criteria?
This is to facilitate picking more invoices in duplicate check net.
Regards,
VijayDear Vijay
Yes, you can control this via business transaction events. Please review the below explanation.
In Rel 4.6, duplicate invoices are checked using function module
FI_DUPLICATE_INVOICE_CHECK which is called when invoices are posted via trans FB60. Duplicate invoice checking criteria can be customized using the open FI interface SAMPLE_PROCESS_00001110 (custom function module) starting from Rel 4.6. Please verify if the open FI interface 00001110 is being used in your system and review duplicate invoice selection criteria via trans BERP. You may wish to omit the document date (BLDAT field from the duplicate invoice check criteria to trigger error msg F5117. In addition, table BSIP (vendor duplicate documents) may need to be updated. (see note 114563 for further info).
Please also check note 537213, and note 31771 for your information.
If this helps please reward with points.
Best Regards
Kesav -
How to find Related Tables for the Tcode given.
How to find Related Tables for the Tcode given. (master data)
Thanks in advance.Hi Sridhar,
Welcome to SDN.
The tables for a given transaction can be seen in the transaction SE80.
First goto SE93.
Give ur Tcode and find the program name.
Now goto SE80. select program in the first dropdown and give the program name in the second box. U can find the list of tables used.
One more way is : use ST05.
and One more is using FM 'get_tables'
Thanks,
Shailaja
Edited by: Shailaja on Jul 11, 2008 12:33 PM -
How to get LASTDAY for each and every month between given dates..
Hi Friend,
I have a doubt,How to get LASTDAY for each and every month between given dates..
for ex:
My Input will be look like this
from date = 12-01-2011
To date = 14-04-2011
And i need an output like
31-01-2011
28-02-2011
31-03-2011
is there any way to achieve through sql query in oracle
Advance thanks for all helping friendsHere's a 8i solution :
select add_months(
trunc(
to_date('12-01-2011','DD-MM-YYYY')
,'MM'
, rownum ) - 1 as results
from all_objects
where rownum <= ( months_between( trunc(to_date('14-04-2011','DD-MM-YYYY'), 'MM'),
trunc(to_date('12-01-2011','DD-MM-YYYY'), 'MM') ) );
The above two query is worked in oracle 11GActually the first query I posted is not correct.
It should work better with
months_between(
trunc(to_date(:dt_end,'DD-MM-YYYY'),'MM'),
trunc(to_date(:dt_start,'DD-MM-YYYY'),'MM')
)Edited by: odie_63 on 12 janv. 2011 13:53
Edited by: odie_63 on 12 janv. 2011 14:11 -
How do I check for null date entires using custom JScript on a SharePoint NewForm.aspx?
Hi,
I have the below JScript:
/*Function to convert the US Date format to UK date format */
function parseDate(input) {
var parts = input.split('/');
// new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])
return new Date(parts[2], parts[1]-1, parts[0]); // months are 0-based
/*Function to check if end date is before the start date */
function checkDates(){
var sd = parseDate($("input[title='From']").val());
var ed = parseDate($("input[title='Until']").val());
if(sd > ed) {
alert("Please check From and Until Date");
$("input[value$='Save']").attr('disabled', true); //hide save button
else
$("input[value$='Save']").attr('disabled', false); //show save button
The above works fine for checking sd > ed but I can't seem to check for null's, I have attempted the below which doesn't work:
/*Function to convert the US Date format to UK date format */
function parseDate(input) {
var parts = input.split('/');
// new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])
return new Date(parts[2], parts[1]-1, parts[0]); // months are 0-based
/*Function to check if end date is before the start date */
function checkDates(){
var sd = parseDate($("input[title='From']").val());
var ed = parseDate($("input[title='Until']").val());
if( (sd > ed) || (sd == null) || (ed == Null) ) {
alert("Please check From and Until Date");
$("input[value$='Save']").attr('disabled', true); //hide save button
else
$("input[value$='Save']").attr('disabled', false); //show save button
Any help appreciated.Hi aspnet-scotland,
Please post ASP.NET related questions in
ASP.NET forums where you could receive better responses.
Thanks for your understanding.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Maybe you are looking for
-
JVM CRASH with the error msg An unexpected error has been detected by HotS
Iam using Jboss 4.2.2 for my application the JVM is crashing with the following msg when i call a function in a DLL (JNI) the error msg : # An unexpected error has been detected by HotSpot Virtual Machine: # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at
-
When I try to open itunes I get this msg: this application has failed to start because 3ivx.dll was not found. If I completely uninstall itunes and reinstall it, it will work for that session. If I close it down and try to reopen I get the error msg
-
New bug in Ultrabeat into Logic Pro 8.0.1
Hey guys check this... a brand new bug (hope it would be only my mac, but with 8.0.0 there wasn't) so open ultrabeat, choose the preset called Drag & drop samples under Drum Kits. (just to use one free preset) load a file and record something, then p
-
Don't know where to put this question All of a sudden I cannot get anything showing on my desk top when I plug my memory sticks in to open them. When I remove them it says DEVICE REMOVAL etc. Have I done something stupid? Any help please.
-
Anyone got stuck in this loop before ?? any ideas ??