How to compare the Two Date field
Hi
i am doing a program with has two field in the Database IssueDate and the ReturnDate. But these two Field Data Type are Text. i don't use them as Data/Time. Now i want to compare the ReturnDate With Today's Date. That is whether ReturnDate is Less than Today's Date.
Please give me a suggestion to proceed with this Particular Program.
Thank you for your suggestion
jofin
Hi thank you for your reply
1) i am Creating a library system In that when i issue a book i have to add the number days that a candidate Eligible to hold the Book with a Issue Date and store it as a Return date.
2) i want to know who has to return the Books on Today.
3) i want to know you has to return the Book Yet.
For 1 st one i used GregorianCalendar gcal=new GregorianCalendar();
ridate= gcal.get(Calendar.DATE);
rimonth=(int)gcal.get(Calendar.MONTH)+1;
riyear= gcal.get(Calendar.YEAR);
rissuedate = ridate+"/"+rimonth+"/"+riyear;this and Calulate it the Returndate.
is it Possible to convert This rissuedate = ridate+"/"+rimonth+"/"+riyear; string into date like this Formate dd/mmd/yy. and store the Date in the Database
if so please tell me how to write a query to insert a date and while retriving how to retrive the Date.
i mean when we retrive a String from database we use getString(); method . Like this how to retrive the Date
Please help me on this Issue
Thank you very much for your Help
Cheers
Jofin
Similar Messages
-
How to compare the two same fields of different tables
Hi can any one let me know the logic for compare the two fields of different tables.
hi
good
IF it_1[] = it_2[].
" Tables contents are the same
ELSE.
" Tables contents are different
ENDIF.
If they have different structure, you probably must loop one of the tables, and inside read the other, then compare field by field.
Or if you don't need the contents (just comparing) you can do this, for example:
LOOP AT it_1 INTO wa_1.
READ TABLE it_2 WITH KEY field2 = wa_1-field2
field5 = wa_1-field5
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
" Record is on both tables (field2 and field5 are the fields in common for both tables).
ENDIF.
ENDLOOP.
thanks
mrutyun^ -
How to compare table's date field with dropdown year field
Hi All,
I have one requirement to display the selected rows from a database table based on the selection of drop down.
Here, I have one dropdown of year(like 2009,2010,....) and I have one database table which contains one field with "DATE".
Now, I want to compare table's DATE field with my dropdown field.
Problem is that table's DATE field is of type "DATS" and dropdown is of type INTEGER(or) STRING ...
How to compare this fields?
Can any one please give me solution for this...!
Thanks in Advance!Hi sreelakshmi.B,
try the following:
DATA lt_dats TYPE TABLE OF dats.
DATA l_dat_i TYPE i.
DATA l_dat_c_4(4) TYPE c.
DATA l_dat_c_12(12) TYPE c.
DATA l_dats_from TYPE dats.
DATA l_dats_to TYPE dats.
*Move Date from Integer to Char
l_dat_c_4 = l_dat_i = 2005.
*Create Date From use in WHERE-Clause
CONCATENATE '01.01.' l_dat_c_4 INTO l_dat_c_12.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = l_dat_c_12
IMPORTING
date_internal = l_dats_from
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*Create Date To use in WHERE-Clause
CONCATENATE '31.12.' l_dat_c_4 INTO l_dat_c_12.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = l_dat_c_12
IMPORTING
date_internal = l_dats_to
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
* Select records in range
SELECT *
FROM [DBTAB]
INTO TABLE [ITAB]
WHERE [DATE] BETWEEN l_dats_from
AND l_dats_to.
Regards
REA -
How to make the 'Finish Date' field Editable in Project server 2013
Hi All,
In Project server 2013 on premises deployment, When I try to create a new enterprise project [Also in case of new custom project type], Only the 'Start Date' field is available. The 'Finish Date' field is by default taking the value of the 'start Date' itself.
I am unable to make this 'Finish Date' field editable.
Any pointers on this would be very helpful,
Thanks
ShankyShanky --
When you create a new project in either Microsoft Project Professional or Project Online, the system does not allow you to enter both a Start date and a Finish date for the project. Here is how the software works:
You enter the Start date of the project.
You completely plan the project with tasks, task dependencies, task Durations, and assigning resources to tasks.
Based on the Start date you provide, plus all of the task information, the software calculates the Finish date of the project for you. So, you cannot provide both the Start date and the Finish date, nor is they any way to force the system to allow
you to do this. Hope this helps.
Dale A. Howard [MVP] -
How to compare the current date to an inputed date?
I am having a validation to check if the date is not After the current System Date?
public String getDate_trans()
try {
Date x=new Date();<<Get the current Date
Date date=new Date();
DateFormat formatter ;
formatter = new SimpleDateFormat("yyyy-MM-dd");
date = (Date)formatter.parse(date_trans); <<<Inputed Date
System.out.println(date);
System.out.println(x);
if(date<x)
System.out.print("Date is Valid");
else
System.out.print("Date is invalid");
catch (ParseException e)
{System.out.println("Exception :"+e); }
return date_trans;
}tr3k wrote:
I dunno what to method to use in there...I'm so sorry...The closest method that I could use I think is the compareTo...but I dunno how I can use that to compare using greater than or less than.....Read the docs for that method. READ THE DESCRIPTION. What do you not understand about that?
And there are two other methods that are even simpler. You haven't looked closely enough. -
How to compare the two field in jasper report design
hi to all,
I am new to jasper report design
I want to compare two fields (or) variable using if..else condition.
pls help me outCheck out these postings:
http://forum.java.sun.com/thread.jspa?threadID=5286462
http://forum.java.sun.com/thread.jspa?threadID=5286468 -
How to extract the a date field from a text value?
Hi,
SAMLE TEXT Date: 06-FEB-14 02:47:07
I have sample column in flat file like mentioned above, i need to capture only the date from this column. Can anyone please help me on how to extract this date from the column?Dear Mohammed Shariff,
My suggestion is check it in google you can find no.of formulas related to excel.
Ur's
Mohan -
How to get the current date and compare dates
hi
does anyone know how you would get the current date?
furthermore, how to compare the current date with a past date to see how many days or months have past since then?
thankshave a look at the Date class. new Date() creates an object containing the exact date and time at creation time. (Date).getTime() might be useful for comparing two dates. GregorianCalendar might be useful, too.
-
How to compare the contents of two different tables
hello. can somebody give me an idean on how to compare the contents of two different tables in mysql?
example, i have a table named Main List and a table named New List.
The contents of the New List should be compared to the contents of the
Main List, to check if they are equal. I don't have any idea how to manipulate
this data. Hoping for your help. Thanks.it is better to comapre it using java.. try get the resultset first and store that in collections then comapre the two collections
-
Formula for compare two date fields
Please help me,
There are two date fields in DSO , I want to create a key figure by Query Designer, the condition as blow
Count ( If field DateA > field DateB = 1 else 0 ).http://www.sd-solutions.com/SAP-HCM-BW-Replacement-Path-Variables.html
create 2 formula varaibles like above and comapre it -
How can I reference records outside the two date parameters?
Hi all,
I have a query that fetches records based on the two date parameters defined (Startdate and Enddate).
If the Startdate is 2014-12-01 and the Enddate is 2014-12-12, I want to pull records outside these two date parameters, that is 2014-09-01 and 2014-11-30.
I want to add up the records from 2014-09-01 and 2014-11-30 and include them in one of the columns in my report.
I tried using this query:
SUM(CASE WHEN FilteredIncident.Statuscodename IN ('QUEUED', 'ASSIGNED') AND (EnteredOn >= '2014-09-01' AND EnteredOn<= @StartDate) THEN 1 ELSE 0 END) AS OpenRecords
Please help with any ideas..thanksPlease follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you probably need to read and download the PDF for:
https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
There is no such crap as a “status_code_name” in RDBMS. It has to be a “<something in particular>_status”; think about how silly that data element name is! Want to keep going and have a “status_code_name_value_id”? LOL!
The name “Filtered_Incident” is also wrong. Tables are sets, so unless you have only one element in this set, the table name should be a plural or (better) collective name. But a better question is why did you split out “Filtered_Incidents” from “Incidents”?
Would you also split “Male_Personnel” and “Male_Personnel” from “Personnel”?
Get a book on data modeling and learn some basics.
>> I have a query that fetches records [sic: rows are nor records] based on the two date parameters defined (report_start_date and report_end_date). If the report_start_date is 2014-12-01 and the report_end_date is 2014-12-12, I want to pull records [sic]
outside these two date parameters, that is 2014-09-01 and 2014-11-30. I want to add up the records [sic] from 2014-09-01 and 2014-11-30 and include them in one of the columns in my report. <<
Having no DDL and no sample data makes this hard. Does your boss make you program without any documentation, DDL, etc? This spec is vague; you say to do a total, but show a count, etc.
One of the many nice things about DATE data types is that the BETWEEN predicate works with them, so you can quite writing 1960's BASIC predicates with primitive logic operators.
Here is a guess:
SELECT SUM(CASE WHEN incident_date BETWEEN '2014-09-01'
AND @report_start_date THEN 1 ELSE 0 END)
AS open_record_cnt
FROM Incidents
WHERE incident_status IN ('QUEUED', 'ASSIGNED')
AND incident_date <= @report_end_date;
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
How to Calculate AGE by getting difference between two Date Fields
HI Gems
I need to calculate AGE from getting difference from two date fields. But when i am trying to wrte fromula as Current date - date1(some date field) then it is showing error.
How can i get values.
Thanks
ManuYou already asked this question:
How to calculate AGE from two different date fields -
How an i compare the two forms ( script) that are in two systems ?
Hi,
How can I compare the two forms(sap script) which are in different versions or systems? One form is in D22 and other form is P22 .
My requirement is to change the form when they are different.
Thanks,
Suresh.Hi,
You can download the form info for each script and compare these two files.
In the SAPscript choose Utilities -> Form info and save this as a file. As they are structured in the same format you can then look for differences in these files rather than having to look through the form window by window.
Regards,
Nick -
How to make the Profit Center Field Mandatory in Cost center Master Data
Dear All,
Please let me know how to make the Profit Center Field mandatory in Cost Center Master Data as well as my Internal Order Master Data?
Thanks in advance!
Regards,
Rajeswari Shankar.Hi Rajeswari,
You can modify message number KS096 to "Error" via OBA5. Thus, the users would no be able to save a cost center without entering a profit center. (Depending on your release you can make KS096 modifiable by implementing note 486781.)
Concerning the internal orders (transaction KO01), you can run KOT2 and set Profit center field as required entry in "change field selection" section.
Regards,
Greta -
How to compare the programs in two different systems
Hi,
I have two systems say A & B and i have the program say 'Z_TESTPROG'.
How to compare the program in two different systems.
Regards,
VenkatHi,
Check the version in Utilities -> version -> version management in both servers is one option.
Another one is using SE39 transaction.
Regards
Manasa
Maybe you are looking for
-
In GP how to get work items in outlook inbox
Hi, Any one can explain me how to send work items to Outlook Mail. This option is there in ABAP work flow. I need solution in GP. Please give any sloution. Thanks, Sunil
-
I have a pdf with columns of text. I'm sure that, pre-Lion, I used to be able to select a single column by alt-clicking and dragging. Now if I do that, the selection is haphazard or, more often, it simply draws a rectangle around my target column but
-
Intercompany Billing and Delivering Plant
Hi, I had selected a delivering plant for my intercompany billing, that was different from the one previously assigned to my sales organisation and company code. However, even after cancelling those assignments, I still cannot use my original plant
-
Running Creative Cloud on an HP with 18Gb Ram - I'm working on a project using 3 yr old dngs and when I open in my up to date Camera Raw it uses the old interface with 'contrast' towards the bottom and 'recovery' below 'exposure' - how do I get Camer
-
I have a 2011 15" MacBook Pro that stopped working today. I was ripping a DVD onto it using software I had just downloaded off of the Internet. I left it for about 20 minutes and came back and it was off and won't turn on. When I left the battery was