How to extract only month and date ?
Hi All,
I have a problem to query the customer details. It goes this way, Today is 02-AUG-2007, when i issue my query today, irrespective of the year, takin only the date n month i.e 02-AUG into consideration and comparing it with birthdate column in the customer table, such that birthdates (irrespective of the year) which are in 15 days before or after 02-AUG must be displayed.
Example. SYSDATE : 02-AUG-2007,
OUTPUT: All B'Dates which are in the range 17-JULY(SYSDATE-15,irrespective of year) to 17-AUG(SYSDATE+15,irrespective of year) irrespective of year must be displayed.
Regards,
SAM
or like this:
with bd
as ( select sysdate -16 dt, 'A' as pt from dual
union all select sysdate-15, 'B' from dual
union all select sysdate-14, 'C' from dual
union all select sysdate, 'D' from dual
union all select sysdate+14, 'E' from dual
union all select sysdate+15, 'F' from dual
union all select sysdate+16, 'G' from dual
union all select sysdate - (365-15), 'H' from dual
union all select sysdate - (365+14), 'I' from dual
union all select sysdate - (365+16), 'J' from dual)
select to_char(dt, 'MM/DD') as bd, pt from bd
where to_date(to_char(dt, 'MM/DD/')||to_char(sysdate, 'YYYY'), 'MM/DD/YYYY') between sysdate - 15 and sysdate + 15
I see this was part of the above suggestion :)
Message was edited by:
smccull
Similar Messages
-
How to extract the size and date from a given file
Hi,
I want to extract the size and date of a file (it can be either a video, audio or text file) that the user points to the location of. But I am not sure how. Does Java have an api that can do this? If not is there some other way of doing this? Can anyone help? Thanks in advance.Have a look at java.io.File, specifically
public long lastModified()
This format returned (I find) is nasty, so then use java.util.Date (or java.sql.Date, look the same on the surface to me) to format it.
Cheers,
Radish21 -
How to get ONLY month and MONTH within date...
I have to convert something from sql server to oracle.
In SQL Server I have:
SELECT
TEXT_26 AS CostUnit,
MILESTONE_DATE AS ContractShipDate,
ACTUALFINISH AS ActualShipDate FROM PROJ_TASK
WHERE
TEXT_29='SHIP'
AND NAME NOT LIKE 'CMSB%'
AND NAME NOT LIKE 'CCFB%'
AND (MONTH(ACTUALFINISH) = MONTH(GETDATE()) - 1)All seems very simple SQL except I don't know how to convert that last line:
... AND (MONTH(ACTUALFINISH) = MONTH(GETDATE()) - 1)Basically Im just extracting the month so that I say the MONTH of the actual finish date is equal to the month of Today - 1. Meaning get the month for today (GETDATE() in sql server) and then subtract ONE month from it.
How can I do that line in oracle?
Thanks,
JonI generally find it simplier if one answers the question I posedYou need to realize that with free advice and help you get what you pay for. If you want people to run the statements for you then you should provide create table and sample data scripts.
Another alternative is
trunc(actualfinish,'mm') = add_months(trunc(sysdate,'mm'),-1)http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/functions201.htm#i79761
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/functions004.htm#i76717 -
How To Get Only Month or Only Year from datetime format of yyyy-mm-dd
Hi SQL gurus,
I have field has datetime format of yyyy-mm-dd (ie. 2014-11-28). Could anyone please educate me on how to extract only month (ie. November but not 11) and only year (ie, 2014) from 2014-11-28. I writing two report have title of Number of
sick leaves on November and Number of sick leaves in 2014. I am planning to extact 11 from 2014-11-28 and display as November on report title and the same goes for 2014. Unless you have better non complicated way. Thank you
very much in advance. DingDong!!There are multiple ways
Month name
SELECT DATENAME(mm,@DateParam)
SELECT FORMAT(@DateParam,'MMMM')
Year
SELECT FORMAT(@DateParam,'yyyy')
SELECT DATEPART(yy,@DateParam)
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Problem to insert only month and year instead of full date
select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
b.epd, b.lpd
from prl_daftar_proses a, senarai_pesalah b, penjara p
where a.no_daftar=b.no_daftar
and a.episod=b.episod
and b.penjara_id = p.penjara_id
and a.setuju_jplp is null
and a.bulan_proses between to_date(:FROM,'dd/mm/yyyy') and to_date(:TO,'dd/mm/yyyy')
order by b.penjara_id, a.bulan_proses,a.no_daftarHi,anyone can help me how i can insert only month and year from the value that have full date in the database??
for example,the date is 09/18/2012, but i just want to insert 09/2012 as parameter. If i want to insert only one parameter, i can do that..But i have problem when I want to insert two parameters..jeneesh wrote:
Welcome to the forum..
This..?
Assuming bulan_proses is a date without time part
select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
b.epd, b.lpd
from prl_daftar_proses a, senarai_pesalah b, penjara p
where a.no_daftar=b.no_daftar
and a.episod=b.episod
and b.penjara_id = p.penjara_id
and a.setuju_jplp is null
and a.bulan_proses between to_date(:FROM,'mm/yyyy') and last_day(to_date(:TO,'mm/yyyy'))
order by b.penjara_id, a.bulan_proses,a.no_daftar
i got another problem..
before that.may i know what is the function of last_day? -
Concept:
Every month i need to find the list of .rar files from the
E:/TempBackup directory from the different environments (remote desktop servers) and i need to delete the current month
.rar files alone from the respective (E:/TempBackup) directory. below is example files structure inside the
E:/TempBackup.
example:
zDROP_2014_08_31_Backups.rar
zDROP_2014_09_31_Backups.rar
zDROP_2014_10_31_Backups.rar
from the above list i need to delete the zDROP_2014_08_31_Backups.rar(current month) file alone and also logs should be capture for this deletion.
key words for this are zDROP and Current month and date.
i need a stored procedure for this concept. could you please help on this.Hello,
You can schedule an operating system task (Control Panel -> Schedule task) to either call a batch file or a PowerShell script.
Please read the following resources for examples:
http://social.technet.microsoft.com/Forums/windowsserver/en-US/61373719-fffb-4d94-bdbe-7d8ed8620b44/delete-filesfolders-on-remote-servers-using-powershell?forum=winserverpowershell
http://www.networknet.nl/apps/wp/archives/943
http://jeffwouters.nl/index.php/2011/10/powershell-script-to-delete-files-older-that-a-week/
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com -
Can we modify the pnp selection screen and get only month and year?
Dear Freinds,
I have requirement where i have to modify the PNP selection screen. So with the help of report category and coding in AT SELECTION-SCREEN OUTPUT , i have modified all the fields relating to dates . i.e i have removed all the radio buttons (i.e Today, Current month,current year etc) and finally
i have landed with only Period ( PNPBEGDA & PNPENDDA range) . But i dont want the PNPBEGDA & PNPENDDA range , but i want only is the month and year ( i.e just like the PNPPABRP & PNPPABRJ)
on my selection screen along with the pernr .
i have used the below code to close all the fields except pnpbegda and pnpendda.
AT Selection-Screen output.
loop at screen.
IF screen-group4 = '098' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '092' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '094' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '100' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '104' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
MODIFY SCREEN.
endloop.
i.e on my selection screen i want only month & year combination and pernr -
when iam using the logical database PNP . Could any one please let me know how can i get only mon & year only on my selection screen .
If it is possible please let me know .
Thanks & regards
divya.Hi ,
The requirement is that the user doesnt want to enter the date range i.e for ex: 01012008 to 31012008.
As per the requirement the user will enter only the month and year only . so i on the selection screen
i want only the month and year only . Is there any means i can modify the date period which is there by
default (PNPbegda and PNPendda) on PNP selection screen. Instead of we givign to the user the
PNPBEGDA and PNPPENDA i want is only month and year .
AS already the code has already been written and now they have asked that they want only the month and year on the selection screen.
Please suggest me in this regard.If iam hiding all the buttons relating the dates fields, and now if iam adding the parameters for the month and year it is coming below below the fields pernr , personnel ara and subara , company code , payroll area, employee group of the standard fields of PNP selection screen , there by any body could please suggest me how to change.
regards
divya. -
Can anybody tell me how to extract sales value and cost value for an materi
dear all,
Can anybody tell me how to extract sales value and cost value for an material sold .
All the values of cost value and sale values are getting stored in bseg-wrbtr field .
How to identify them uniquely.
Or there is another way to find the sale and cost values.
Regards
MaveHi Mave!
Normally there is no condition change, when something is sold.
But sales price depends on sales conditions (not only price, but also surcharges, discounts, taxes - if customized).
Nevertheless, after selling you have a invoice document, where correct values <i>should</i> be stored (see VBRP fields mentioned above). If here is a problem, then customizing of price determination is in question, not a programming of user-exits with MARD selection for costs (or some other tries to get a price).
When you specify your requirements more in detail, you might get better answers - but currently only general hints are possible ('see in invioce / G/L accounts').
Regards,
Christian -
ALV: how to display only subtotals and total rows in the output
ALV: how to display only subtotals and total rows in the output
i am getting output
i am getting subtotals for respective fields
but i want to display only subtotals and totals rows in the output
i have tried the
totals_only parameter in slis_layout_alv
but it is not working.hi,
For TOTAL
For the amount field / quantity field in the field catalog give DO_SUM = 'X' for WHOLE total
For SUBTOTAL
For subtotal you will have to create an internal table sort..Let's say you want to do subtotal for each customer..
DATA: lt_sort type SLIS_T_SORTINFO_ALV,
ls_sort type slis_sortinfo_alv.
CLEAR ls_sort.
ls_sort-spos = 1.
ls_sort-fieldname = 'Give the field name that you do the sum'.
ls_sort-up = 'X'.
ls_sort-subtot = 'X'.
APPEND ls_sort TO lt_sort.
fieldcatalog-do_dum = 'X'.
for subtotals
WA_SORT-FIELDNAME = 'ERSDA'.
WA_SORT-SPOS = '2'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOTAL = 'X'.
APPEND WA_SORT TO IT_SORT.
Refer
http://help.sap.com/saphelp_erp2004/helpdata/en/ee/c8e056d52611d2b468006094192fe3/content.htm
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/doesnt-function-event-subtotal_text-in-alv-713787
regards,
Prabhu
reward if it is helpful -
How to get current month and last month dynamically??
how to get current month and last month dynamically
like
month = getCurrentMonth();
lastmonth = getcurrentMonth() -1;
please help
thankshi :-)
/* depracated but can be still useful */
java.util.Date dtCurrent = new java.util.Date();
int month = dtCurrent.getMonth();
int lastmonth = dtCurrent.getMonth() - 1;
System.out.println("* " + month);
System.out.println("* " + lastmonth);
/* better to use this one */
Calendar cal = new GregorianCalendar();
int imonth = cal.get(Calendar.MONTH);
int ilastmonth = cal.get(Calendar.MONTH) - 1;
System.out.println("*** " + imonth);
System.out.println("*** " + ilastmonth);
regards, -
Getting year, month and date
I am getting the current year, month and date as follows:
public void setDate(Date date) {
String strDate = "";
//year
Calendar cal = Calendar.getInstance();
cal.setTime(date);
strDate += cal.get(Calendar.YEAR);
//month
strDate += cal.get(Calendar.MONTH) + 1;
//date
strDate += cal.get(Calendar.DATE);
this.date = strDate;
}This gives me the date in teh format yyyymd.
i.e for Mar 5 2007, it returns 200735
How can it retrieve it in yyyymmdd format?
i.e. Mar 5 2007 must be 20070305use the function:
private String getTwoNumberFormat(int i){
if (i<10)
return "0"+i;
else
return ""+i;
}and then call
//month
strDate += getTwoNumberFormat(cal.get(Calendar.MONTH)+1);or use SimpleDateFormat :) -
How do i reset time and date on my itouch
how do I reset time and date on my itouch?
Go to Settings>General>International and make sure that Calendar is set to Gregorian.
Bext
Try:
- Reset the iOS device. Nothing will be lost
Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
least ten seconds, until the Apple logo appears.
- Reset all settings
Go to Settings > General > Reset and tap Reset All Settings.
All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
- Restore from backup. See:
iOS: How to back up
- Restore to factory settings/new iOS device.
If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
Apple Retail Store - Genius Bar -
I had a trouble with my lap top and had to format hard disk and install all soft ware again. could any body tell me how to transfer the application and data in my i phone back to itune.
You can't. It still thinks that your iPhone is synced with another iTunes library (the one that you had before you reformatted the hard drive.
-
Seeing the month and date in the finder bar?
In the 'finder bar(?)' I have the day of the week and the time. Is there anyway to have the month and date there too? Instead of having to click on it and seeing it below?
Thanks, JordanYou can do this via the International preference panel.
Click on the Customize button next to the "Dates" section.
Select and copy the entire date there.
Then click on the "Customize" button next to the "Times" section. Make sure the "show" menu is set to medium. Click to the right of the Time so the insertion point is next to the current time, put a separater character such as "|" then past the date into the field.
Then close the window. That's it. -
How do I transfer files and data from my Samsung Galaxy tab 2 to my Macbook Air?
How do I transfer files and data from my Samsung Galaxy tab 2 to my Macbook Air? The Macbook does not even recognize the device. I get an error message. I follow the instructions on the message, which tells me to install "Kies" and Android file transfer. This does not help. What do I do?
See:
iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device
Maybe you are looking for
-
I can no longer send mail from my gmail account on my iPad.
I can send mail from my iPhone just fine so it isn't gmail. I deleted the gmail app and reinstalled it; restarted my iPad; and checked the settings. My wifi is working as is evidenced by the fact that I wrote and posted this from my iPad with no prob
-
Search appointment by ICal in EWS Managed
Hi all, First of all, i have tried with the solution of henning however it dont seems to be the correct one... (http://www.infinitec.de/post/2009/04/13/Searching-a-meeting-with-a-specific-UID-using-Exchange-Web-Services-2007.aspx) We have in our appl
-
Documentation for SAP function modules??
Hello, is there any documentation for the SAP function modules available? I need documentation for SJ01 (SAP Objects). If I try to view the documentation in SE80, I get the error message: "Document OJ_XXX(whatever I selected) is not available in lang
-
Hierarchy extraction from R/3 Table to BW
Hi Gurus/All, I need extract the Organizations Hierarchy Structure data from R/3 "Z table".Please any one can give me the detailed steps to extract the Hierarchy data from R/3 "z table" in to Bw.It is Masterdata extraction and the hierarchy has 5
-
Installing a New Windows Server 2008 R2 Child Domain by Using the Command Line
Installing a New Windows Server 2008 R2 Child Domain by Using the Command Line: http://technet.microsoft.com/en-us/library/cc731873%28v=ws.10%29.aspx dcpromo /unattend /InstallDns:yes /ParentDomainDNSName:mysite.com /replicaOrNewDomain:domain /newDom