Substruct 2 Dates and get full month difference
HI,
I have a start Date coming from a DB like 3/10/2006
and I have the Date of today like 5/20/2006.
I need to find the difference in full months between this 2
dates???
return should be like >TimeUsed.text = "3";
Can someone help please?
Thankyou
Flash already knows the current date, so you could use
something like:
aDate="3/10/2006";
TimeUsed.text = monthsBetween(toDate(aDate),new Date()));
//followed by attached code
If you are given both dates, from database....
aDate="3/10/2006";
bDate="5/20/2006";
TimeUsed.text = monthsBetween(toDate(aDate),toDate(bDate));
//followed by attached code
Similar Messages
-
Substacting two dates and get result in months
Hi Friends
I have to subtract two dates and get the difference in months. Here's the sample data:
select DATE '2009-10-01' Date_value, 111 Cust_id, DATE '2009-10-22' Open_date from dual
union all
select DATE '2009-10-01', 112 , DATE '2009-10-15' from dual
union all
select DATE '2009-10-01', 113 , DATE '2009-10-5' from dual
union all
select DATE '2009-11-01', 111 , DATE '2009-10-22' from dual
union all
select DATE '2009-11-01', 112 ,DATE '2009-10-15' from dual
union all
select DATE '2009-11-01', 113 ,DATE '2009-10-22' from dualAnd here’s my query to get the difference in month:
SELECT cust_id, date_value, open_date,
ROUND (ABS (date_value - open_date) / 365 * 12) diff_in_months
FROM tBut the output is unexpected:
CUST_ID DATE_VALUE OPEN_DATE DIFF_IN_MONTHS
111 1/10/2009 22/10/2009 1
112 1/10/2009 15/10/2009 0
113 1/10/2009 5/10/2009 0
111 1/11/2009 22/10/2009 0
112 1/11/2009 15/10/2009 1
113 1/11/2009 22/10/2009 0Ideally, the output should be as per the following:
CUST_ID DATE_VALUE OPEN_DATE DIFF_IN_MONTHS
111 1/10/2009 22/10/2009 0
112 1/10/2009 15/10/2009 0
113 1/10/2009 5/10/2009 0
111 1/11/2009 22/10/2009 1
112 1/11/2009 15/10/2009 1
113 1/11/2009 22/10/2009 1What is wrong in my query?Hi Centinul
Found the resolution. When I use the following query, I get the perfect result:
SELECT cust_id, date_value, open_date,
ROUND (ABS (MONTHS_BETWEEN (open_date, date_value))) months,
ROUND (ABS (date_value - open_date) / 365 * 12) diff_in_months,
MONTHS_BETWEEN (date_value,ADD_MONTHS (LAST_DAY (open_date), -1) + 1 ) final_val
FROM tAnd here's the output of all three columns:
CUST_ID DATE_VALUE OPEN_DATE MONTHS DIFF_IN_MONTHS FINAL_VAL
111 1/10/2009 22/10/2009 1 1 0
112 1/10/2009 15/10/2009 0 0 0
113 1/10/2009 5/10/2009 0 0 0
111 1/11/2009 22/10/2009 0 0 1
112 1/11/2009 15/10/2009 1 1 1
113 1/11/2009 22/10/2009 0 0 1 -
What a have is a VI that uses the following SUbvi's, starts with FP OpenVI, then FP Create TagVI, into a "While Loop" which contains a FP ReadVI outputting data into a Index ArrayVI outputting to a Display (DBL). This shows the output of a FP-AI-100 monitoring a 9v battery. I have to monitor this battery for a 4 hour period my problem is storing the 4 hours of data and getting it out of the "while loop" into a "Write to Spreadsheet File VI" all I seem to accomplish is just one data sample which I get into a spreed ship file with no problem. I just can't get 4 hours worth. By the way this is my first VI and I'm self
trained so have mercy.I figured it out thanks.
John Morris
Glendinning Marine -
What a have is a VI that uses the following SUbvi's, starts with FP OPENvi, then FP Create Tagvi, into a "While Loop" which contains a FP READvi outputting data into a INDEX ARRAYvi outputting to a Display (DBL). This shows the output of a FP-AI-100 monitoring a 9v battery. I have to monitor this battery for a 4 hour period my problem is storing the 4 hours of data and getting it out of the "while loop" into a "Write to Spreadsheet File vi" all I seem to accomplish is just one data sample which I get into a spreed ship file with no problem. I just can't get 4 hours worth. By the way this is my first VI and I'm sel
f trained so have mercy.I figured it out Thanks.
John Morris
Glendinning Marine -
Calculate end date from inputs : start date and number of months
Hello Experts,
I have a start date and number of months from which i need to calculate the end date.
For Eg: start date = 03-12-2008
no. of months = 48
Ans: end date = 03-12-2012
Please help me.requirement is no different from what is stated in the previous thread.
To elaborate further, I'm looking for some Function Module or some relevant alternative to calculate the future date.
Future date is calculated using a start date input and No. of months.
As stated in the example in my previous thread.
For eg:
Inputs to FM : Start date : 03-12-2008
No. Of months : 48 months
Output from FM: Future Date : 03-12-2012
Looking forward for your reply. -
How describe model data and get select in DB throw topLink.
Hello,
I have table from code
create table t_tree
id int primary key,
parent_id int,
value varchar2(255)
Alter table t_tree
add constraint constr_id_parent foreign key (parent_id) references t_tree (id)
I must get query
select level as lv,lpad('-@-', (level-1)*2)||value as MMM, t.* from t_tree t
connect by prior id=parent_id
start with T.PARENT_ID is null
How describe model data and get select in DB throw topLink.
Dema.So you'll probably have to write a function which uses dynamic SQL to retrieve the desired message text, like this untested one:
CREATE OR REPLACE FUNCTION get_msg(p_db IN VARCHAR2,
p_id IN NUMBER)
RETURN VARCHAR2
IS
msg_txt VARCHAR2(4000);
BEGIN
-- make sure p_db is a valid database link ...
EXECUTE IMMEDIATE 'SELECT d_msg FROM msg@' || p_db || ' WHERE t_id = :id' INTO msg_txt USING p_id;
RETURN msg_txt;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN NULL;
END get_msg;
/The you can update likeUPDATE mex
SET t_msg = get_msg(db_id, t_id);Hth, Urs -
Hi,
I bought 20GB storage plan by mistake. I would like to downgrade and get full refund.
thnx in advance.You should contact apple at http://www.apple.com/contact/
All the best Txlasho ! -
How to refund 10GB Icould storage and get full refund
How to refund 10GB Icould storage and get full refund
http://support.apple.com/kb/ht4847
For a full refund, contact iCloud Support within 15 days of an upgrade or within 45 days after a yearly payment. Partial refunds are available where required by law. -
When I open FaceTime my screen also shows contacts list how do I remove this and get full FaceTime screen to return?
When I open FaceTime my screen also shows contacts list how do I remove this and get full FaceTime screen to return?
-
Why does my data plan get full fast?
what should i do not to waist my data? i have limited and its full in two weeks!!! what can i do on the iphone change settings or what need help.
Data can be difficult to manage. You may have to turn everything off and gradually turn functions on one by one weekly.
Here are a few tips:
When the iphone goes into sleep mode, WiFi is turned off to conserve battery when unplugged from a power source. The phone will then use the cellular data network for all data needs.
MMS and Visual Voice Mail use data to transmit pictures, videos, and audio.
Turn off push notifications. The data usage adds up quickly.
Turn off push email. It’s small but it adds up. Switch to fetching email in manual mode.
Don't use location based alerts in the Reminders app
Turn off weather and stocks in notification center.
iCloud and iCloud enabled apps use data. When you update a contact it is updated in iCloud. You can use the backup and Photo Stream they only use WiFi.
Find my iPhone is helpful but it also uses data.
Turn off all Cellular data if you are close to you limit.
iMessage uses data to avoid SMS and MMS usage.
Things to avoid on 3G
Anything that streams.
Online storage apps
Online gaming
Google Maps or any apps that use location data
App Store or iTunes
If you are constantly finding yourself getting billed for extra data use every month it may be a better idea just to upgrade to a bigger data plan.
Hopefully it helps
https://discussions.apple.com/thread/3211548?start=0&tstart=0 -
To extend SAP user date and to add months to the current date
Hi All,
I need to extent the user date in SAP based on one condition.
If the condition is true extend the date by 12 monthd if false 6 months from the current date.
Can i have the FM for user date extentions and FM for getting the date.
Thanks,
Chandu.Hi ,
You can use this FM for exteding the date.
CALL FUNCTION 'BAPI_USER_CHANGE'
EXPORTING
username = us_username
logondata = e_bapilogond
logondatax = e_bapilogondx
TABLES
return = i_return.
u need to pass date and correspoing flag also.
For extension of the date by months u can use this FM.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = 6 or 12 ( depending up on ur logic)
olddate = sy-datum
IMPORTING
newdate = us_expdate.
Thanks and regards.
Sham -
How to check image GPS data and get image file from image field
Hello,
I have some trouble and want to fix this problem.
1. I want to validate image file before its attached in image field about the image file have a GPS data or not. Have any way that can be check about image has contained a GPS data?
2. After validate image and PDF form is upload to the server. I want to get image file that embed in image field, because I have to extract image from PDF form and store this image in project image folder. If this topic can be fix by code script please give me some example code.
Thakyou for every comment and suggestion
Best Regards,
MaiHi Naill,
First I have to say thankyou for your answer.
About my (1) question, My image fields have set to be a embedded data and I try to test many example script of image fields.I can get image content type, image size. But that not work when I used ImageField1.desc.embeddedHref.value. It's response as "Unknown Embedded URI". Therefore, image field is and embedded data. How can I access filename?
(2) In that forum. As I see, his problem is about how to automate change image field with href image file. But I want to extract an exist embedded image in PDF form to normal image file with original metada (such as extract image filed to .JPEG with GPS data. Same as before attached in PDF form.). There has any concept or solution in this problem?
Best Regards,
Mai -
Howto: comparing 2 dates and getting the seconds
By comparing 2 dates I need to extract or get somehow the elapsed seconds. I need to get only
the seconds.
Dates are in this format "hh:mm:ss"
I tried with Date and GregorianCalendar but I couldnt get the desired result.
Can someone provide me with a sample code please.remus.dragos wrote:
Its not broken, nor absurd or complicated. I only need resolution only for minutes. The method that I use does not need to know more than 20 seconds.
But I added minutes knoledge aniway. As you can see its easy to add hour resolution if needed. But I didnt needed it so thats why I took that approach.
This looks cleaner for you? I just wrote it here, untested, but should work.
public int returnSeconds(Calendar c1, Calendar c2)
int mins = c1.get(Calendar.MINUTES) - c2.get(Calendar.MINUTES);
int secs = c1.get(Calendar.SECONDS) - c2.get(Calendar.SECONDS);
if (mins > 0) return secs+=mins;
else return secs;
}And why should I treat all the time as miliseconds since the epoch. Thats an absurd afirmation without a detailed explanation.
Edited by: remus.dragos on Apr 30, 2008 6:18 AM- Unnecessary creation of expensive Calendar objects.
- Significantly slower
- Breaks across Timezones
- Unnecessary decision making introduces complexity
- Introduces a bug by assuming c1 represents a time greater than c2
- Introduces a bug by not multiplying minutes by 60 to obtain seconds.
- Makes assumptions about the calendar system in use
- Less maintainable because it limits the scope of time unit resolution handled by the logic
I probably missed some more too. None of this is needed, and it is very brittle. Your problem can be solved by subtracting one fixed-point number from another. Go with es5f's approach. -
BI- Extract Hour:Min from date and get Avg
Hi there,
am working on BI answer and trying to get the average of the working hours of the departments. The Working Hrs column is Date format in the Database. And I managed with Forum help to Extract the Hours from this column and do the average through the BMM in the RPD on the Fact table as following:
EXTRACT( HOUR FROM "Ain_Access"."Fact_Access"."Working Hours")
Now on the BI Answer results I have 8 instead of 08:57.
But what I need is to Extract the Hour and the minuets and get their AVG.
Appreciate your help,Averaging column with date/time format in BI Answer
this expression will work:
(60 * EXTRACT( HOUR FROM "Ain_Access"."Fact_Access"."AVG Working Hours" ) + EXTRACT( MINUTE FROM "Ain_Access"."Fact_Access"."AVG Working Hours" )) / 60
but only if this "AVG Working Hours" is DATE type.... and this look like strange name fore DATE? "AVG" is average, aren't?
Arent u need to use "Working Hours" instead of "AVG Working Hours" ?
like this:
(60 * EXTRACT( HOUR FROM "Ain_Access"."Fact_Access"."Working Hours" ) + EXTRACT( MINUTE FROM "Ain_Access"."Fact_Access"."Working Hours" )) / 60
all best
phenix -
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.
Maybe you are looking for
-
On Dell core2duo - QuickTime PictureViewer does not work
I have some considerable problems with QuickTime's PictureViewer application. The system has Windows XP pro and a core 2 Duo processor running at 1.86Ghz - also has 2 Gb ddram. Norton internet security is installed and up to date. Once the PictureVie
-
Doesn't want to retain WiFi settings
I turn of my TC SSID broadcast. All of my computers, iPhones, iPads, printers, etc seem to be able to stay connected indefinitely and after reboots. My wife's MB (late 2008 model) doesn't seem to want to retain the network name, and periodically ha
-
In PSE 10 Organizer I cannot download the entire thing - just one photo appears
When I try to access the Organizer in PSE 10 I get only one photo. What am I doing incorrectly?
-
Hello Gurus, i'm right now installing a NW 7.3 Java with the Adobe Usage type. Does any of you have a "post Configuration/Processing manual" that I can follow to configure Adobe ? One litle more question, in the old Adobe that I've (Double Stack Aba
-
How to develop e-commerce using java
Can you please give me the source code for building e-commerce/web site using java?