How to compare two dates and find exactly
How to compare two dates and find the exact age of the person, no one could be an age of child 2 days or a month, or other.
I'd really appreciate if someone help o
Concerning
After spending 2 hours, I go out with a solution by myself, how ever the function can be customize to check if the user enters date right.
function findAge(subjectName,fromdate, todate) { console.log("findAge(fromdate, todate) is called now "+subjectName+"-->"+fromdate+"-->"+todate); if(todate) todate= new Date(todate); else todate= new Date(); var age= [], fromdate= new Date(fromdate), y= [todate.getFullYear(), fromdate.getFullYear()], ydiff= y[0]-y[1], m= [todate.getMonth(), fromdate.getMonth()], mdiff= m[0]-m[1], d= [todate.getDate(), fromdate.getDate()], ddiff= d[0]-d[1]; if(mdiff < 0 || (mdiff=== 0 && ddiff<0))--ydiff; if(mdiff<0) mdiff+= 11; if(ddiff<0){ fromdate.setMonth(m[1]+1, 0); ddiff= fromdate.getDate()-d[1]+d[0]; --mdiff; } if(ydiff> 0) age.push(ydiff+ ' year'+(ydiff> 1? 's ':' ')); if(mdiff> 0) age.push(mdiff+ ' month'+(mdiff> 1? 's':'')); if(ddiff> 0) age.push(ddiff+ ' day'+(ddiff> 1? 's':'')); if(age.length>1) age.splice(age.length-1,0,' and '); console.log("==============================="); console.log("Subject age is = "+age.join('')); console.log(" age Day = "+ddiff); console.log(" age Month = "+mdiff); console.log(" age Year = "+ydiff); console.log("==============================="); var subjectAGE = age.join(''); }
peardox Thanks for the reply
Tags: BlackBerry Developers
Similar Questions
-
How to compare two dates and times in BPEL?
Hi all
I need to compare two dates and times in a switch activity, but could not find any function for her.
My switch like this activity:
case Date1 > date2:
do something;
otherwise:
do something;
He is not such a function in 'The functions of Date' and can not find this function to xpath.
IBE, there is no function for a period of time to make (less one date of another?...) If this return to the data compare question).
Thank you.Hello
Logic function as more/less function can be used to compare two dates so that same comapring two numbers.
Ex: If your variable reception contains two pieces of data such as date1 and date2, then you can use format in condition switch below.
XpathXpression (date1) > XpathXpression (date2)
hope this will help you.
-
Hello
I have two columns (start date and end date) data type date in my page and both are optional.
I need a validation on these date columns,
End date should not be greater than the Start Date.
This validation must be triggered once I click the button apply.
Pseudocode:
If (endate > startdate)
{
raise form_trigger_failure;
}
Can anyone suggest how/where to apply the code, if possible, please indicate the code of the sample.
Thank you
MaheshHello
Please refer to the code below, and try to apply in the same way. It should solve your problem
import java.util.Date;
/ * In LICS * /.
If (pageContext.getParameter (Apply)! = null) / * ID of the button apply * /.
{
String strStartDate = pageContext.getParameter ("SearchStartDate");
String strEndDate = pageContext.getParameter ("SearchEndDate");
System.out.println ("Start Date:" + strStartDate);
System.out.println ("End Date:" + strEndDate);
If ((null! = strStartDate) & (null! = strEndDate) & (""! ")) = strStartDate) & (""! ") = strEndDate))
{
Day dtStartDate = new Date (strStartDate);
Day dtEndDate = new Date (strEndDate);
System.out.println ("Start Date:" + dtStartDate);
System.out.println ("End Date:" + dtEndDate);If (dtEndDate.getTime)<>
{
System.out.println ("inside the date validation and error messages jet");
OAException dateMessage = new OAException ("XXNCV", "XXNCV_Date_Message", null, null, OAException.ERROR),
oapagecontext.putDialogMessage (dateMessage);
oapagecontext.setForwardURLToCurrentPage (null
true
OAWebBeanConstants.ADD_BREAD_CRUMB_NO
OAWebBeanConstants.IGNORE_MESSAGES);
}
}Thank you best regards &,.
REDA PapdejaPublished by: RajPapdeja on June 15, 2010 13:12
-
How to compare two TABLES and different lines of list?
I have two structural equal paintings aaa and bbb
that (could) have different lines.
How can I compare the tables and display different lines?
PeterSomething like this->
SELECT aaa.*,'bbb' "Not present in" FROM aaa MINUS SELECT bbb.*,'bbb' "Not present in" FROM bbb UNION ALL ( SELECT bbb.*,'aaa' "Not present in" FROM bbb MINUS SELECT aaa.*,'aaa' "Not present in" FROM aaa )
Kind regards.
LOULOU.
-
Find the difference between two date and time
Hi friends,
I wanted to find the difference between two date and time, but my qury is slightest error "invalid number."
select sql_step_num,proc_name,run_seqno,start_date,end_date,(to_char(start_date,'HH24-MI-SS') - to_char(end_date,'HH24-MI-SS') ) as ed from eval.EVAL_RUNTIME_DETAILS where trunc(start_date) = trunc(sysdate) order by sql_step_num;
You try to get the feel between two char strings.
And more difference between two dates gives a NUMBER of days.
Try this:select sql_step_num,proc_name,run_seqno,start_date,end_date,numtodsinterval(end_date-start_date,'DAY') as ed from eval.EVAL_RUNTIME_DETAILS where trunc(start_date) = trunc(sysdate) order by sql_step_num;
-
How to compare two lines in PL/SQL?
Hi all
How to compare two lines in PL/SQL? Is there a method I can use to compare their column by column instead?
Any comments would be much appreciated.PhoenixBai wrote:
By lines I mean, two rows of the same table!Ah, finally, we get a bit more useful information
and I need to compare the column by column to see if there is a difference between these two rows.
Like this, you mean?
SQL> ed Wrote file afiedt.buf 1 with data as (select 1 as id, 'A' as dta, 'B' as dta2 from dual union all 2 select 2, 'A', 'B' from dual union all 3 select 3, 'B', 'C' from dual) 4 -- 5 ,chk as (select &id1 as id1, &id2 as id2 from dual) 6 -- 7 select case when ( 8 select count(*) 9 from ( 10 select dta, dta2 11 from data, chk 12 where id = id1 13 minus 14 select dta, dta2 15 from data, chk 16 where id = id2 17 ) 18 ) = 0 then 'No Difference' 19 else 'Difference' 20 end as check_result 21* from dual SQL> / Enter value for id1: 1 Enter value for id2: 2 old 5: ,chk as (select &id1 as id1, &id2 as id2 from dual) new 5: ,chk as (select 1 as id1, 2 as id2 from dual) CHECK_RESULT ------------- No Difference SQL> / Enter value for id1: 1 Enter value for id2: 3 old 5: ,chk as (select &id1 as id1, &id2 as id2 from dual) new 5: ,chk as (select 1 as id1, 3 as id2 from dual) CHECK_RESULT ------------- Difference SQL>
My only concern is the result of this sql. East - reliable? It can really be used to differentiate the two lines? I mean, the result would be the same, as I do with Java?
Not sure what you mean by "reliable"? SQL is not some kind of generator of random result (by derogation from the use of the DBMS_RANDOM package). If you ask him if 1 + 1 = 2, then it will always give you the right answer.
-
How to assimilate two Dates in flex
Hello
I need to compare two dates, the < and > works pretty but == show no results, even if two dates are equal. Now I'm equating taking date, month, year, hour, time of two dates. Y at - there no direct way two find if two dates are equal or not.Date are usually stored more than a millisecond to a point of reference, in flex, this reference is midnight Jan 1, 1970. There are two ways to get this number: property at the time when the valueOf() method. Then
var d1:Date =...
var d2:Date =...If (d1.time == d2.time) or if (d1.valueOf () == d2.valueOf ())...
ATTA
-
Camileo S20 - How to display the date and time
Hi, all. I got as Christmas present the Camileo S20, and I am not able to view the date and time in the video. In the manual is no reference on this subject, only how to set the date and time. But what is the intention to set the date and time in the camera, if it is not possible to display video?
Hello
Have you checked the user manual of your TV cam?
If it of possible to display the data and the time you can find in your user manual how to do this. It always interesting to read ;) s
-
How to set the date and time in eAiO Officejet Pro 8600?
The printer is connected with the USB cable and the date & time display zeros. I wasn't able to find a menu option for date & time setting in the printer Panel. The user guide mentions nothing about it. How can I configure date and time?
Hi Exxpert,
Here is a tutorial from HP on how to set up this printer, scroll all the way down to step 9 for the date and time.
Configuration printer Officejet Pro 8600
I hope this helps!
-
How to compare two files to see the differences in the content?
How to compare two files (one word and a single pdf) to see if the files are identical without having read all 7 pages?
Thank you
You cannot compare files of different nature. If you convert the Word file to PDF, you can then compare the two files in Acrobat.
-
can anyone tell how to compare two documents with two controlled with the same mouse pointers
can anyone tell how to compare two documents with two controlled with the same mouse pointers?
Windows and OS X can only display a mouse pointer - it is created by the operating system, not the application.
-
How to compare two different backgrounds
Can one tell me please how to compare two circles as DEVL test?
I don't know how to compare a project (like DEVL test) but I want to see all the changes in all the objects between two different backgrounds.
Please help me.
Thank you.use AppDesigner, navigate to tools / compare and report / database
The target DB access code,
Press Options
comparison of Goto tab options & select compare Type = database -
How to set the date and time on my HP Officejet pro 8600 more?
How to set the date and time on my HP officejet pro 8600 more? It just on a printed journal Jan-oo-oo fax shows 00:00 AM. There are no instructions on how to change this. I need proof that I sent a fax to a certain date and time. Help, please. Thank you
Hello
Below are the steps to set the Date and time for your device:
- On the Control Panel, press the right arrow key ( ), press Setup ( ).
-
How to read the date and time of a file by labview information
How to read the date and time of a file by labview information? for example, time created and updated time.
The similar question had already spoken here (this is the old thread but still seems topical):
http://forums.NI.com/T5/LabVIEW/file-date-created/TD-p/109836
-
Hello
I'm trying to follow the steps described in the following link:
How to set the Date and time on a remote target in Measurement & Automation Explorer (MAX)?
It is said
The software on the target currently supports only the time zoneand deletes the old files?
I need set the date and time
and remove all the old unwanted files
the calendar was gray does not allow me to change the current date.
Anyone know how to change
Hi all!
According to this the below Knowledge Base article, Remote Configuration System Support must be installed on the target for time settings to change in MAX.
If you don't know what version of the system supported remote Configuration software that you have installed on your device target, it is likely that it is not yet installed. Add this software by clicking below your target to the MAX software option and selecting "Add/Remove Software". This is where you will install the System Configuration Remote Support software.
Please let us know if you have any questions!
Maybe you are looking for
-
It is supported the home page. Even if google is my homepage, I have to go to tools, default homepage, press home page on the page and it goes to google. When I close and reopen the browser, YAHOO. It's boring. I deleted every trace I can find in the
-
For some reason any my iphone 6 has suddenly stopped to reduce emails, they are just sitting in the waiting area, I'm running on iOS 9.3.1 can anyone help.
-
Windows Vista Edition Home Premium BSOD "Bad Pool Header" Help!
I can't not understand how to solve this problem, I searched everywhere on the internet and I tried solutions told me, I don't know if I have done wrong or what, but please help me. If I can't understand that this point I will be without a computer u
-
Original title: having touble delete messages in Windows Mail In Windows Mail, I have a problem deleting messages, a note comes up saying "an unknown error has occurred." Messages can be opened with the message "message was not found. I am running Vi
-
Hola, queria averiguar donde puedo descargar los drivers of SM - easy cap USB 007 para la a greeting