Current Date plus number of days script
Hi All,
I have a form I am building which has a date field (currently setup to specifiy todays date on load). There is a field that slects number of days until a billing cycle (currently 0 through 13 days).
I need to setup a script that takes todays date, adds the number of days from the 0-13 result and gives a result of a date (0-13 days from today for example).
Any thoughts on how I might do this? Very new to JS.
Thanks for any help you may be able to provide.
Ant
here is an example of what I have used:
var f = this.getField("BILLINGCYCLEDATE");
var g1 = this.getField("DAYS");
var g = g1.value
var today = new Date();
var add = d1.valueOf();
add +=1000 * 60 * 60 * 24 * g;
var future = new Date(add);
f.value = util.printd("mm/dd/yyy", future);
You would want to set this up as a calculation in your BILLINGCYCLEDATE field. The field DAYS is whatever you have set up as the 0-13 counter. I set up a simple text box where you input a number. The field will then calculate X number of days out. Hope this helps.
Similar Messages
-
Get Date x number of days before current Date
How do you subtract x number of days from a Date object?
Is there a better way than
int x = 28; // number of days
long minisPerDay = 24 * 60 * 60 * 1000;
Date newDate = new Date (oldDate.getTime() - (x * minisPerDay );> How do you subtract x number of days from a Date object?
Calendar c = Calendar.getInstance();
c.setTime(yourDateInstance);
c.add(Calendar.DATE, -x);
Calculating Java dates: Take the time to learn how to create and use dates
Working in Java time: Learn the basics of calculating elapsed time in Java
Good luck! :o)
~ -
How to automatically update the Expiry Date's number of days
My web app input form is an event submission form. Users enter the event title, event date and other details, etc. I've figured out how to get the "expiry days" in the form and it be hidden but i can't figure out how to calculate this:
(today's date) - (event date) + 1 day = number of days to expire and then set the expiry days to that value upon submission.
I have tried writing the js but am getting no where, has anyone out there already accomplished this? I've researched and researched and find a million things on calculating the number of days but can't get one of them to work for my situation here... any help would be greatly appreciated!!Hi Murtuza,
You can use function module BAPI_ISUACCOUNT_CHANGE.
Pass dunning lock details in parameter TCTRACLOCKDETAIL. This function module only create and delete locks.
So, you need to pass existing lock details (from table DFKKLOCKS) with PROCESSING_MODE = 04 (delete) and append another value with changed expiry date with PROCESSING_MODE = 01 (Create).
This will also help in maintain lock history too.
Hope this helps.
Regards,
Avinash -
Conversion of Date into Number of Days
Hai All,
Can anyone pls tell how to convert the Date format into Number of days.
For example I have 2 dates, 25.03.2009 and 25.02.2009.
I have to take the difference of these two dates, means its 30 days.
Later I have to move this 30 days to a variable and display.
Can anyone help me.Try these FMs.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = p_sdate
i_datum_von = p_edate
IMPORTING
e_tage = l_differ
EXCEPTIONS
days_method_not_defined = 1
others = 2.
WRITE:/ l_differ.
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = p_sdate
i_date_to = p_edate
I_FLG_SEPARATE = ' '
IMPORTING
E_DAYS = EDAYS
E_MONTHS = EMONTHS
E_YEARS = EYEARS.
WRITE:/ No of Days ', EDAYS.
Regards,
Joan -
Datepicker - setting selected date as current date plus 3 days
Hi,
I have a datepicker in my visual webpart.
I want to set by default as "today's date + 3 days".
Example: if today is 25 Feb, then the datepicker should have selected date as 28
I am aware of this:
DTDefaultDate.SelectedDate = DateTime.Today;
How to add the 3 days to it?
ThanksHi,
If you want to set the DateTimeControl to a specific date, please take the code below for a try:
DateTimeControl1.SelectedDate = DateTime.Today.AddDays(3);
More information about DateTime.AddDays Method:
https://msdn.microsoft.com/en-us/library/system.datetime.adddays(v=vs.110).aspx
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
contact [email protected]
Patrick Liang
TechNet Community Support -
Need to add number of days to users end date.
Hi,
I have a code where we are adding number of days(30) to current date and then updating user's end date in IDM DB.
Now we have a requirement where we need to add number of days(30) to existing end date of user instead of adding to current date.
*public String incrementDate(int daysToAdd)
// Start date
log.info("NotifyLastDayOfService::incrementDate(): Enter");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, daysToAdd); // number of days to add
String newDate = sdf.format(c.getTime());
log.info("NotifyLastDayOfService::incrementDate(): Exit");
return newDate;
Have any body implemented this scenario?
Please suggest.
Thanks,
Kalpana.Hi Nayan,
Here is the code:
System.out.println("----inside increment date method-----");
HashMap<String, String> hm = new HashMap<String, String>();
HashMap<String,Date> modifyMap=new HashMap<String,Date>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
tcResultSet usrList = null;
String enddate = null;
hm.put("Users.Key",usrKey );
try {
usrList = this.usrIntf.findUsers(hm);
usrList.goToRow(0);
Date endDate =usrList.getDate("Users.End Date");
System.out.println("-----users end date-----"+endDate);
String userEndDate=sdf.format(endDate);
System.out.println("-----String value of users end date-----"+userEndDate);
Calendar cal=null;
System.out.println("-----Calender date-----"+cal);
cal.setTime(endDate);
System.out.println("-----end date-----"+endDate);
cal.add(Calendar.DATE, Integer.parseInt(daysToAdd)); // number of days to add
Date newEnddate = cal.getTime();
System.out.println("-----new end date-----"+newEnddate);
//usrList.setEndDate(Edate);
modifyMap.put(userEndDate,newEnddate);
usrIntf.updateUser(usrList, modifyMap);
System.out.println("updated user's end date in OIM DB");
//System.out.println("-----updated user's end date in OIM DB-----");
logger.info("NotifyLastDayOfService::incrementDate(): Exit");
System.out.println("-----new date-----");
} catch (tcAPIException e) {
logger.error("Error in finding end date for user" + e);
} catch (tcColumnNotFoundException e) {
logger.error("Error in finding end date for user" + e);
In th log file, I can see that the code is not executing this line:
cal.setTime(endDate);
end date is of type Date and stores users end date from DB. Please help in resolving this issue.
Thakns,
Kalpana. -
How do you work out the number of days difference between two dates?
I'm running Crystal v12.
We use a date field in our SQL database that we use to store the client's year end date.
As the year end date (date and month) doesn't change for a client, the year end date field in all of our reports is set to just show the DD/MM part. Over the years as new clients are set up we just enter the date and month - the year part is irrelevant although as in all date fields the year is automatically entered.
Doing it this way means that we don't have to adjust the year end year part each year. We just use the DD/MM part.
I need to create a formula that works out the number of days there have been (i.e. the difference) from the current date to the year end date. It MUST EXCLUDE the year however.
For example:
Year End Date = 30/04/03
Current Date = 25/05/10
Days Difference (EXCLUDING year) = 25
Days Difference (including year) = 2582
Year End Date = 31/03/09
Current Date = 25/05/09
Days Difference (EXCLUDING year) = 55
Days Difference (including year) = 420
If you include the year part then working out day difference is simply a case of creating a formula that subtracts the year end date from the current date (CurrentDate - {tblClient.YearEnd}.
HOWEVER I need to exclude the year part.
Can anyone tell me the formula or best way to do this?
Thanks in advance.
Edited by: BadBoy House on May 25, 2010 3:15 PM
Edited by: BadBoy House on May 25, 2010 3:15 PMHi
You can try this
datevar e := date(year(currentdate),month({tblClient.YearEnd}),day({tblClient.YearEnd}));
numbervar num_days := datediff("d",currentdate,e)
Create a datevar called e that uses the original month and day numbers for {tblClient.YearEnd} but uses the year of the current date
Then just datediff on e to get the number of days between the two dates
I hope i understand your problem and that this helps
Best regards
Patrick -
Dynamic variant creation, Current date "-NNNN" *(4 digit number)*
Hi,
Is there any way of creating "-NNNN (4 digit number)" for dynamic date calculation in variant variables?
I need to set 4 digit number in the "DLFL to Change Date (Old ver: To Change date)" field but system only allow total 4 digit including +/-. I'll be using the "Current date +/- ??? days" option to set date dynamically.
In order to set deletion flag for PM orders older than 6 years, I need "Current date -2190".
Or is there other way to set it as MONTH when calculating the change date?
I'm using PM order initial archiving job whose report name is RIARCORV.
Thanks in advance,
Alex
Edited by: Alex Kwon on Jul 16, 2009 2:44 AM
Edited by: Alex Kwon on Jul 16, 2009 2:45 AMAlex,
I dont think its possible to do the same using the variant functionality. You will have to do some workaround to accomplish the same by either using other fields like Order number.You could also look at enhancing the code implicitly in the RIARCORV program, if you are in ECC6.0 or above versions.
Regards
Narasimhan -
I am trying to imbed a formula that will look pull in the current date, then subtract 91 days from it. I am wondering if anyone can help me with it?
Tried:
timestampadd(SQL_TSI_DAY, -91,Date)
ADDDATE(CURRENT_DATE, INTERVAL 91 DAY);
Thanks,it has to be
30 days ago sales = total sales - sales for last 30 days
or logical column could be
case when sales_date < (SQL-___days, -30, current_date) then Sales else 0 end -
Dynamic Date Calculation for Current Date - 1
I am trying to create a variant with a dynamic date calculation attribute.
I am following the instructions as they are posted to the web but I get an error message.
I want to get all data EQ to the current date -1
In the object for selection screen I enter a D for Selection Variable, for Name of Variable I enter an I to include specific values and the option EQ for current date +/- ??? days. Then I enter 1- for the number of days. I have tried to enter this many times and in many ways but it doesn't work. I keep getting this message "lower limit of interval is greater than upper limit"Hi,
Welcome to SDN.
Selection-screen has four values -
SIGN
OPTION
LOW
HIGH
Pass your date value in the option low for the screen.
Sign you have already pass as I and option as EQ.
Regard,
Amit
Reward all helpful replies.
Can you paste your code here.
Message was edited by:
Amit Khare -
Dvt:schedulingGantt : to show current date directly with the week
Hello everyone,
i use Jdeveloper 11g and ADF.
I use this component: "dvt:schedulingGantt" and
Q1: I would like to know if I can show directly when I'm going on this page the current week.
Q2: Is it possible to put on "Start time" field the current date minus one month? and "End time" field the current date plus one year?
Thank you
RegardsAre you sure you haven't committed one of the cardinal sins of the Java-ignorant by confusing it with Javascript?
-
Todays date plus a set number of days
I know I'm just having a brain fart here, this has got to be
easier than I'm making it.
Essentially, I have a variable bit of text that I need to
display todays date + 10 days.
Getting todays date and formatting it are simple I know:
var today_date:Date = new Date();
// place date into US date format
var date_str:String =
(today_date.getMonth()+1)+"/"+(today_date.getDate()+"/"+today_date.getFullYear());
// display current date
trace(date_str);
The problem lies in making todays date plus 10 days..... any
ideas anyone?
~Chuck MoultonDo your date additions with the Date object then extract the
data to do the formatting afterwards...
var today:Date = new Date();
trace(today); //today
var addAWeek:Number =7; //days
today.setDate(today.getDate()+addAWeek)
trace(today); //its not today anymore its a week from today
//extract the portions and format now -
FM which gives the date if we add 'x' number of days to the current date.
Hi all,
can you plz tell me the FM which will give me the exact date if i add some ' X ' number of days to the present date.
in detail -->my inputs would be 1)DATE
2)no of days
i need--> the exact date which comes after those days get added to the given date.
PLZ HELP ASAP.
Rgds,
REDDY.Hi,
You can use FM RP_CALC_DATE_IN_INTERVAL.
data: wa_date like sy-datum.
*Add 21 days to current date.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 21
months = 0
signum = '+'
years = 0
importing
calc_date = wa_date.
write: / wa_date.
Regards,
Ferry Lianto -
Number of days (current date-goods receipt date)
Hi All,
I have a requirement like this :
need to display no of days in Query which is CKF=current date-GR date. GR date is coming from r/3.We do not have current date field. and moreover no of days is in the selection screen.So we should have no of days calculated already in the cube.am i rght? calculation shold be done before data comes into the cube i.e in transfer rules or update rules...thats what i thought.Am i rght? can anybody come up with some code to calculte no of days in transfer rules or update rules?
pl correct me if i am wrong.
regards
Message was edited by: cmdWhen your write code in transfer rules it will be global.
if u write code in update rules it will local to on data target.
Transfer rules----
InfoSource
Update reules----
data target.
here infosource is re-usable to other datatargets, so it will effect to all.
but update rules is only one data target.
i think u clar about this.
pls assgain poinst, if u satify.
by
ANR -
Adobe LiveCycle Designer 8 - Add days to Current Date in another text field
Hi-
I am working on an expense report. I have six fields, CurrentDate, and countDate1 through countDate5. The CurrentDate is a Time/Date field which the user can select whatever date is needed with the drop down calendar. The other five countDate fields are "text" fields which will represent Monday through Friday. I would like to add zero days to whatever the user selects as the CurrentDate and make that appear in countDate1 which represents Monday(the CurrentDate the user selects will always be a Monday), add one day to whatever the user selects as the CurrentDate and make that appear in countDate2 which represents Tuesday...and so on. I realize this is probably basic for someone familiar with FormCalc but I'm very new at this.
This got me very close but I want the user to select the date and not have the CurrentDate already filled in.
CurrentDate - DateTime field, FormCalc calculation script:
num2date(Date())
Date1 - Text field, FormCalc calculation script:
Num2Date( Date2Num(CurrentDate.formattedValue))
Date2 - Text field, FormCalc calculation script:
Num2Date( Date2Num(CurrentDate.formattedValue) + 1 )
Thanks!
BrianHere is an exmaple of adding days the script is used in the "exit" event for the date select field that has display format of "MM/DD/YYYY". Adding days requires add x number of days to the days since the epoch date for the current date, adding months or years one needs to manipulate the string parts of the date.
----- form1.#subform[0].InputDateField::exit: - (FormCalc, client) ---------------------------------
// fomatted string for selected date
var sFmtDateValue = $.formattedValue
var sMsg = Concat("Entered date formatted: ", sFmtDateValue) // build message string
sMsg = Concat(sMsg, "\u000a" ) // add new line to message
// convert date string to days since epoch date - format is important
var fDaysPast = Date2Num(sFmtDateValue, "MM/DD/YYYY")
// add 7 days to days past epoch date
var f7DaysPlus = fDaysPast + 7 // add 7 days
var s7DaysPlus = Num2Date(f7DaysPlus, "MMM DD, YYYY") // format string for 7 days plus
sMsg = Concat(sMsg, "\u000a", "Plus 7 Days: ", s7DaysPlus) // build message string
// add 14 days to days past epoch date
var f14DaysPlus = fDaysPast + 14 // add 7 days
var s14DaysPlus = Num2Date(f14DaysPlus, "MMMM DD, YYYY") // format string for 7 days plus
sMsg = Concat(sMsg, "\u000a", "Plus 14 Days: ", s14DaysPlus) // build message string
// display results
// work on months
// get parts of date past epoch date
var sFullYear = Num2Date(fDaysPast, "YYYY") // get 4 digit year form days past epoch date
var sMonth = Num2Date(fDaysPast, "MM") // get month form days past epoch date as number
var sDate = Num2Date(fDaysPast, "DD") // get date form days past epoch date as a number
var s2Month = Sum(sMonth, 2) // add 2 months
var s2FullYear = sFullYear
// if more than 12 months in new date adjust year on number of months
if (s2Month > "12") then
s2FullYear = Sum(s2FullYear, + 1) // increment year
s2Month = Sum(s2Month, - 12) // adjsut months
endif
var s2MonthsAdded = Concat(s2Month, "/", sDate, "/", s2FullYear) // date string
sMsg = Concat(sMsg, "\u000a", "Added 2 months: ", s2MonthsAdded) // display stringxfa.host.messageBox(sMsg, "Sample Adding Days" ,3, 0);
var s5Month = Sum(sMonth, 5) // add 5 months
var s5FullYear = sFullYear
// if more than 12 months in new date adjust year on number of months
if (s5Month > "12") then
s5FullYear = Sum(s5FullYear, + 1) // increment year
s5Month = Sum(s5Month, - 12) // adjsut months
endif
var s5MonthsAdded = Concat(s5Month, "/", sDate, "/", s5FullYear) //build Date string
sMsg = Concat(sMsg, "\u000a", "Added 5 months: ", s5MonthsAdded) // display stringxfa.host.messageBox(sMsg, "Sample Adding Days" ,3, 0);
// display results
xfa.host.messageBox(sMsg, "Sample Adding Days and Months" ,3, 0);
Maybe you are looking for
-
== Issue == I have another kind of problem with Firefox == Description == We had a Windows XP net framework update yesterday KB982524, and ever since than when we try to log on to mozilla the program will not respond. We tried re-starting a couple of
-
Issues regarding theMarker value in inventory BI 7.0
Hi, We are facing an issue with the marker update for Stock vertical. As per the process defined by SAP we have loaded the stock report using the marker value of 2LIS_03_BX. 1. We ran setup table in R/3 system for initial value of stock on 26th
-
Windows 7 has Perplexing Behavior on Shutdown
I am sorry to have to post this in an advanced forum like this. My reasoning is that if anyone knows the answer it will be here. When I shut down Windows flashes a screen which says, "Windows waiting for a background program to close." Is there a uti
-
Aperture stores photos, how?
I'm wondering if I have a set of say 2000+ photos that are rather high resolution, if loading up Aperture will create a "library" or "catalog" of those photos? If so, this would mean that it would double the disk space usage for each photo; the copy
-
Desktop Monitor for Web Color Grading
First question is simple: I'm in need of new desktop monitors. Looking towards the Dell Ultrasharps, which have been a favorite in the past, specifically the U2412M. Any other suggestions? Second question, more difficult: I do a fair amount of color