How Do I Calculate Date Difference in Javascript - date

i want to count the date difference (days only) like if i am selecting "Date From" as 08-05-2016 and then "Date To" as 08-11-2016 ... it will calculate the days difference as "7" before submitting in leave count box the values on run time Using Javascript
Below is the text values codes.
Date From: <input type="date" name="from">
Date To: <input type="date" name="to">
Leave Count: <input type="text" name="leavecount">
<input type="submit" name="submit">

Related

Ionic Datetime - use placeholder but also set the date to start

I need to use datetime with a placeholder that says "select your date of birth" when the datepicker is open I need the start date to be 1980, The only way I can do this currently is to set the value of the input to be 1980 but then my placeholder does not display.
Is this possible to achieve with ion-datetime ?
<ion-datetime
displayFormat="DD/MM/YYYY"
placeholder="select your date of birth">
</ion-datetime>
you can display a label at start & then when you click on the label (on focus event or click) you set some attribute to true (you have to set it to false at start) & then when it's true you display the date-time picker instead using *ngIf (also *ngIf for the label).
<ion-item>
<ion-label floating color="secondary">Select Your Date of Birth</ion-label>
<ion-datetime [(ngModel)]="dataofbirthday" displayFormat="DD / MMMM / YYYY" pickerFormat="DD / MMMM / YYYY" monthNames='January,February,March,April,May,June,July,August,September,October,November,December' [min]="mindate" max="2019-12-31" cancelText =Cancel doneText=Select></ion-datetime>
</ion-item>

Paypal - billing cycle length?

Nothing is more confusing to me than PayPal documentation..
Basically I am trying to set a recurring payment. Each month pay 400.50 Euro for 'Membership' Of course the button they provided failed, but I found some examples and came up with:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="example#example.com">
<input type="hidden" name="return" value="http://www.example.com">
<input type="hidden" name="cancel_return" value="http://www.example.com">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="item_name" value="Membership" />
<input type="hidden" name="src" value="1"> <!-- recurring=yes -->
<input type="hidden" name="sra" value="1"> <!-- reattempt=yes -->
<input type="hidden" name="p3" value="1"> <!-- billing cycle length -->
<input type="hidden" name="a3" value="400.50" />
<input type="hidden" name="t3" value="M">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribe_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
What value should"billing cycle length" be - now default 1?
Does this mean once the user clicks my button - a payment will be extracted every month or it will only work one time (that 1 value)?
According to this PayPal documentation p3 is the subscription duration and should be used in conjunction with the value of t3.
Here's the details from that page:
p3 - Required
Subscription duration. Specify an integer value in the allowable range for the units of duration that you specify with t3.
t3 - Required
Regular subscription units of duration.
Allowable values are:
D — for days; allowable range for p3 is 1 to 90
W — for weeks; allowable range for p3 is 1 to 52
M — for months; allowable range for p3 is 1 to 24
Y — for years; allowable range for p3 is 1 to 5
So the current configuration is a recurring payment for only 1 Month.
I hope that this helps!
Use "srt" with some values greater then 1
<input type="hidden" name="src" value="1" />
<input type="hidden" name="srt" value="12" /><!--- 12 Month, paypal allowedonly 12 Month i think--->

Watir,click on a date from a date picker 62 days from current date

I need to click on a date that is 62 days later than the current date.
The next button for the months is clickable so I have been able to move the calendar to 2 months later but unable to select the date.
Eg if the current date is 4 July then I need to select 6th Sept.
My code at the moment looks somewhat like this.
b.element(:name, "policyperiod_endDate").click <-- datetime picker's click
b.element(:xpath, "(//button[#type='button'])[50]").click <-- next month
b.element(:xpath, "(//button[#type='button'])[50]").click
b.element(:link,"06").click <--doesnt select 08
b.element(:xpath, "(//button[#type='button'])[68]").click <-selects fixed cell n
how to select 06?
The outer HTML is like this:
input type="text" class="pull-left pdr35 ng-isolate-scope ng-pristine ng- invalid ng-invalid-required" datepicker-popup="yyyy-MM-dd" is-open="datePickerOpts.datepickers.policyperiod_startdate[1]" ng-model="policyIVOs.policyEndDate" name="**policyperiod_endDate**" datepicker-options="dateOptions" show-button-bar="false" close-on-date-selection="true" show-weeks="false" ng-click="open($event, 'policyperiod_startdate', 1)" min-date="policyEndMin" max-date="policyEndMax" required="" readonly=""

Get date based on month, year, day and week number (ColdFusion)

I found a similar answer to my question, but it was in SQL and kinda went over my head (Given year, month, day and week number how to find the date?(Sql Server 2005 Set based)).
I'm writing a schedule creation app where a user will select the month, day of week (Sun-Sat, aka 1-7), and choose optionally if this will recur throughout the month each week.
Given that, I'm trying to write a function in ColdFusion that will return the actual date if I pass in the month, day, week number, and year. Dates always confuse the heck out of me.
So I know this is an old post but here are some current options in script or tag.
Week Number<br />
<cfscript>
myDateTime = now();
WriteOutput(week(myDateTime & "<br/>"));
</cfscript>
<br />
Day of week<br />
<cfscript>
mydayofweek = (DayOfWeek(myDateTime));
WriteOutput(DayOfWeek(myDateTime & "<br/>"));
</cfscript>
<br />
Day of year<br />
<cfscript>
WriteOutput(DayOfYear(myDateTime & "<br/>"));
</cfscript>
<br />
Days in month<br />
<cfscript>
WriteOutput(DaysInMonth(myDateTime & "<br/>"));
</cfscript>
<br />
<!--- What date are we working with --->
<cfset workingdt = '2022-5-05' />
<!--- Get the week start date. --->
<cfset dtWeekStart = (workingdt - DayOfWeek( workingdt ) + 1) />
<!--- Get the week end date. --->
<cfset dtWeekEnd = (workingdt + (7 - DayOfWeek( workingdt ))) />
<!--- Get the working week --->
<cfset dtworkingweek = '#week(workingdt)#' />
<br />
<!--- Output the dates: --->
<cfoutput>
Today: #DateFormat( workingdt )#<br />
Week Start: #DateFormat( dtWeekStart )#<br />
Week End: #DateFormat( dtWeekEnd )#<br />
Week Number: #dtworkingweek#<br />
</cfoutput>
<br />

ColdFusion Calendar - How can I find day from days in month?

Here's my code. I got it from a tutorial online.
<CFPARAM NAME = "month" DEFAULT = "#DatePart('m', Now())#" />
<CFPARAM NAME = "year" DEFAULT = "#DatePart('yyyy', Now())#" />
<CFPARAM NAME = "currentday" DEFAULT = "#DatePart('d', Now())#" />
<CFPARAM NAME = "startmonth" DEFAULT = "#DatePart('m', Now())#" />
<CFPARAM NAME = "startyear" DEFAULT = "#DatePart('yyyy', Now())#" />
<cfset ThisMonthYear = CreateDate(year, month, '1') />
<cfset Days = DaysInMonth(ThisMonthYear) />
<cfset LastMonthYear = DateAdd('m', -1, ThisMonthYear) />
<cfset LastMonth = DatePart('m', LastMonthYear) />
<cfset LastYear = DatePart('yyyy', LastMonthYear) />
<cfset NextMonthYear = DateAdd('m', 1, ThisMonthYear) />
<cfset NextMonth = DatePart('m', NextMonthYear) />
<cfset NextYear = DatePart('yyyy', NextMonthYear) />
and here is my output code.
<a href="calendar_day.cfm?month=#month#&day=#THE_DAY#&year=#year#">
I'm using this for a visible calendar, and want to be able to select the day from all days in the month. Is there any way to determine the day of the month when clicking on the day in the monthly calendar view?
I believe what you want to use is #URL.day#, to get the day variable passed in the URL, but as everyone is saying your question is really confusing.
As pointed out, the question is pretty confusing.
Is there any way to determine the day of the month when clicking on the day in the monthly calendar view?
You have total number of days in the month in Days var. On the calendar render, you are likely looping through and displaying each day of the month using that var. You can easily embed that loop index into your resulting HTML to know what day any given link would refer to.
<!--- loop thru all days in current month --->
<cfloop from=1 to=Days index="this_day">
<!--- display day in the calendar --->
Day #this_day#
<cfif this_day eq CurrentDay>
<!--- day being displayed is the current day, highlight it or whatever --->
</cfif>
</cfloop>