How do I calculate how many days are left in a month?

I'm trying to figure out a way to do this to make a payment apportion using the days left. One of the problems lies in the date being dynamic, since I'm using "whatever today's date is" and it actualizes by day. Any help will be appreciated.

Using some reusable document level scripts for general functions like getting a field object, a date object from a string, and the number of days in a month one could have a script like:
// document level functions;
function GetField(cName) {
// return the field object for named field;
// with error checking;
var oField = this.getField(cName); // get field object;
// test for error getting field;
if(oField == null){
// error accessing field;
app.alert("Error accessing field " + cName);
// return field object;
return oField;
} // end GetField object;
function GetDateObject(cFormat, cDate) {
// get the date object for date cDate with format of cFormat;
var oDate = util.scand(cFormat, cDate);
if(oDate == null) {
app.alert("Error converting date " + cDate + " with format " + cFormat, 0, 0);
return oDate;
} // end GetDateObject function;
function DaysInMonth(cFormat, cDate) {
// return last day of month;
var oDate = GetDateObject(cFormat, cDate);
var StartDate = oDate.getDate(); // get day from date object;
// set date object to 1st of next month;
oDate.setMonth(oDate.getMonth() + 1, 1);
// set date object to pervious date;
oDate.setDate(oDate.getDate() - 1);
// get last day of month;
return oDate.getDate();
} // end DaysInMonth function;
// end document level functions;
// custom calculation script;
// check for needed functions;
if(typeof GetField != "function") app.alert("Missing GetField function!", 0, 0);
if(typeof GetDateObject != "function") app.alert("Missing GetDateObject function!", 0, 0);
if(typeof DaysInMonth != "function") app.alert("Missing DaysInMonthh function", 0, 0);
// some specific data to get value from field;
var cDateName = "MyDateField"; // name of date field;
var cDateFormat = "dd-mmm-yyyy"; // format of date field;
// end specific data;
// get date field object;
var oDateField = GetField(cDateName);
// get the string value for the date;
var cDateValue = oDateField.value;
// convert date value to date object;
var oDate = GetDateObject(cDateFormat, cDateValue);
var nStartDate = oDate.getDate(); // start date for computation;
// the day for the last day of the month
var nLastDayOfMonth = DaysInMonth(cDateFormat, cDateValue);
var DaysToEndOfMonth = nLastDayOfMonth - nStartDate;
event.value = DaysToEndOfMonth;
// end custom calculation script;

Similar Messages

  • How can I determine how many days are left on an evaluation Enterprise license key?

    I am using the evaluation key available for SP 2010 enterprise. However, I would like to be able to determine how many days remain before it expires.
    Is there a page/link/powershell command/etc. for getting that information?
    Thank you.

    well, I am surprised - and a bit disappointed - that there isn't powershell commands that report the situation.
    But, I can manually go through one machine to find the info, then figure out manually or via some web app when the deadline is.
    I would have thought if Microsoft wanted people to convert an eval to a commercial license so they would make the information appear on the front of central admin

  • Vodafone tell me that is be waiting for unlock by IMEI by Apple, how many days are necesary for it?

    I called vodafone to unlock my iphone 4 by IMEI, they told me that now they are waiting the password from Apple, how many days are necesary for it? thanks

    You don't say where you are but process is
    Carrier approves your request to unlock ?
    they instruct Apple to update their servers to release the lock which is activated via iTunes
    Depends on how fast Vodafone work and how fast Apple update their servers
    For you to activate you need to insert a non Vodafone sim  and connect to iTunes
    When Apple have updated you will get a message
    "congratulations your iPhone is now unlocked "

  • Is how can I calculate how many transition​s are inside an array?

    Let’s assume that we have an array of 582 elements. Some of them are above 4 and some of them are below 1,let’s also say that values who are above 4 are equal to True (1) and the values below 1 are equal to False (0). The question is how can I calculate how many transitions are inside the array from 1 to 0?How many peaks I have? Can please someone suggest a code solution for that?
    Solved!
    Go to Solution.

    If you only care about actual transitions and not the type of them, I'm a fan of the simple XOR.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Count Transitions.png ‏19 KB

  • Is it posible to get how many day's has one specific month with Calendar

    Can any help me how to get how many days one month has. Like february 28, and sometimes 29.

    There is no way to do this within Calendar directly, the Gregorian calendar has a private method that does this, shame its not public.
    You would need to do something like,
    import java.util.*;
    public class MyCalendar extends GregorianCalendar {
        private static final int MONTH_LENGTH[]
            = {31,28,31,30,31,30,31,31,30,31,30,31}; // 0-based
        private static final int LEAP_MONTH_LENGTH[]
            = {31,29,31,30,31,30,31,31,30,31,30,31}; // 0-based
        /** Creates a new instance of MyCalendar */
        public MyCalendar() {
        public final int monthLength(int month, int year) {
            return isLeapYear(year) ? LEAP_MONTH_LENGTH[month] : MONTH_LENGTH[month];
        public static void main(String argv[]){
            MyCalendar cal = new MyCalendar();
            System.out.println( "There are " + cal.monthLength(cal.get(Calendar.MONTH),cal.get(Calendar.YEAR)) + " days this month.");
    }

  • How many IPs are left?

    Is there any way (besides looking at the actual license.bea file) of telling how many IPs are being used. For instance, if I have the 5 IP eval license, can I tell how many are used and how many are free? Same with a PROD license? I know PROD licenses are unlimited, but it would still be nice to know.
    TIA

    Hi biohazard_2626,
    Don is right. By the way, I found the link was somehow incorrect, if you find the same issue, please visit this one below:
    http://support.microsoft.com/gp/customer-service-phone-numbers/en-us
    Regards,
    Melon Chen
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • How do I enlarge the all-day area in iCal?

    Hi there,
    I'd like to have all my all-day events in week-view visible at the same time, but currently I can only see five and a half of them and need to scroll to see the rest. Is there a way to enlarge the all-day area?
    Thanks in advance

    Hi,
    You can only see a limited number of all day events.  I suggest you send Apple feedback if you think it should work differently. https://www.apple.com/feedback/
    Best wishes
    John M

  • How many installs are left on Office Home & Student 2007 disc?

    How do I find out how many installs I have left?  We have no idea if 1 or all have been used.

    Hi biohazard_2626,
    Don is right. By the way, I found the link was somehow incorrect, if you find the same issue, please visit this one below:
    http://support.microsoft.com/gp/customer-service-phone-numbers/en-us
    Regards,
    Melon Chen
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • How do I calculate how much space I need?

    Capturing video from VHS to edit and convert to digital media. Using Blackmagic Thunderbolt Extreme interface. Video is uncompressed when captured. Don't know how much space I need on HD. I have a dozen tapes ranging from 60-90 minutes. Need to capture and return tapes prior to taking time to edit. (Local event, not pirating).

    I think I'll have to try DV instead, a 1TB won't hold them all. Hmmm...
    Thanks for the info.
    Tim Tapio
    Tapio Productions, LLC
    A Service Disabled Veteran Owned Small Business
    910-429-4620
    Seize the Day!

  • How many days left with premiere cs6 trial?

    how do i know how many days i have left on my premiere cs6 trial version? where does it even indicate that the trial version is a trial version?
    thanks in advance!

    When you start up the software, It'll indicate how many days are left for the trial. A trial is usually 30 days, and the countdown starts on first launch.
    The software is fully functional and the trial is not limited in any way. Only that it'll stop working after the trial period is up. At that stage you can enter a serial number and convert the trial to a licensed version.

  • Dreamweaver trial - how many days left?

    Hi,
    Does anyone know how I can find out how many days are left of my free 30 day trial version of Dreamweaver? I downloaded Dreamweaver, Photoshop and Illustrator separately, and Photoshop and Illustrator have a splash screen on opening that tells me how many days are left but Dreamweaver doesn't. Any ideas?
    Thanks for any advice.

    If you know the date that you installed the 30 day trial then that should help give you some idea of when the trial will be over.

  • HT204074 I do not see a "Manage Devices" link when I access my account information through iTunes. I want to know how many devices are linked to my account. Can anyone help?

    I have accessed the Apple Support site http://support.apple.com/kb/ht4627 but I could not find the "Manage Devices" link on iTunes. The advice they give is as follows:
    You can view which devices or computers are currently associated, remove unused devices or computers, and see how long before they can be associated with a different Apple ID from the Account Information page in iTunes on your computer:
    Open iTunes.
    Sign in to your Apple ID by choosing Store > Sign In from the iTunes menu.
    Choose Store > View My Account from the iTunes menu.
    From the Account Information screen, click Manage Devices.
    Next to each device or computer name, you will be able to see when each was associated to your Apple ID. You will also be able to track how many days are remaining before your associated devices or computers can be associated to a different Apple ID.
    Help would be greatly appreciated! Thank you!

    Hello from Albania,
    Please help me !! I'm desperate
    I sold my iPhone 4s a few months ago.
    Now i got my self a new iPad and created a new apple ID which i recently accociated with ITunes and ICloud.
    However, i can't update anything on my Mac since it still requires the old apple id, even though i changed it anywhere i could.
    I also don't get the manage devices when i tried to do this through the iTunes.
    I have no idea what to do.
    Waiting for your reply.
    Regards

  • How to calculate Date and Days

    Hi BW Experts,
    I have requirement, I have field original GI Date and  it is calculating based on 'Original promise date'-'Transport time'. Formula is 'Original GI Date' = 'Original promise date'-'Transport time'.
    We are getting data for original promise date as Date format and  Transport time as Days (ex: 1 or 2 days).
    Here, how can I convert into Date or how can I calculate Date and Days. I am working on BW3.5 .
    Please help me how can I overcome this requirement.
    Points will be assign.
    regards
    Yedu.

    Hi Ventatesh
    It's not a problem
    You can subtract days from date to get the resultant date
    Original Promise time  =  GI Date  - Transit time ( in days)
    Add Original Promise Time in your data target and fill that up with the above rule.
    If the above is not working you can use this function module
    DATE_IN_FUTURE
    Here you need to pass Date and Days to get future date. Only trick you need to apply that if the transit days is 5 days, you pass -5 to this function module.
    But this function module is not available in BW system. Just copy the code from ECC system and create a Z FM for BW system
    Regards
    Anindya
    Edited by: Anindya Bose on Feb 9, 2012 4:36 AM

  • How do I check how many licenses are being used on my order?

    How do I check how many licenses are being used on my order?  I have a Volume License, and I need to know how many licenses are left so I can install on more workstations.

    Adobe Licensing Website | Serial numbers | Orders | Accounts

  • How can I remove the 90 day wait until I can use a new Apple ID on iTunes?

    I recently bought a like new MacBook Pro Retina that only had 16 battery cycles. It was sold to the person I bought it from in March 2013. he sent me the original receipt from the Apple store also.I contacted Apple and they helped me set up a new Apple Admin. account under my name and password. I purchased the extended Applecare under my name for this computer. All is ok there. It is running Mountain Lion 10.8.5 OS and it allowed me to do iPhoto update today.
    I authorized the computer under iTunes and next to it said 83 days before I could use my Apple ID? I unauthorized the computers on my iTunes account for the three under them to clear them off. I reauthorized the MacBook Pro and it seems ok on the MacBook Pro. I went on my Windows laptop and the MacBook Pro was there with the 83 days wait again. So I took it off. Do I have to wait 83 days to use my Apple ID on this computer? I backed up my two iPads on iTunes today and that was fine as it showed them under devices. I am confused.
    Any help?
    Thanks.

    iTunes Store: Associating a device or computer to your Apple ID
    When you turn on iTunes Match or Automatic Downloads, or when you download past purchases on an iOS device or computer, that device or computer becomes associated with your Apple ID. This article describes how to manage these associations.
    Your Apple ID can have up to 10 devices and computers (combined) associated with it. Each computer must also be authorized using the same Apple ID. Once a device or computer is associated with your Apple ID, you cannot associate that device or computer with another Apple ID for 90 days. You can view which devices or computers are currently associated, remove unused devices or computers, and see how long before they can be associated with a different Apple ID from the Account Information page in iTunes on your computer:
    Open iTunes.
    Sign in to your Apple ID by choosing Store > Sign In from the iTunes menu.
    Choose Store > View My Account from the iTunes menu.
    From the Account Information screen, click Manage Devices.
    Next to each device or computer name, you will be able to see when each was associated to your Apple ID. You will also be able to track how many days are remaining before your associated devices or computers can be associated to a different Apple ID.
    Removing an associated device or computer from an Apple ID
    To remove a device or computer from your Apple ID:
    Open iTunes.
    Sign in to your Apple ID by choosing Store > Sign In from the iTunes menu.
    Choose Store > View My Account from the iTunes menu.
    From the Account Information screen, click Manage Devices.
    Click the Remove button next to the device name you would like to unassociate.
    Note: Removing a device from your Apple ID does not override the 90 day timer. The timer must complete 90 days from the day the device was associated before it can be associated to another Apple ID.

Maybe you are looking for

  • Draw document wizard freight value

    Overview of Freight Setting 1.  Admin>> Set up>> General>> freight 2.  Freight set to $10 and drawing method set to NONE / or ALL. Scenario 1.  Sales order has been created with line items and freight at the header level (say $10). 2.  AR invoice win

  • No Audio File in Premiere Pro CS6

    I have a Sony NX30. I use the sony media importer to get the files on my computer and then use the files in Premiere Pro CS6. Everything works fine. I have a new desktop computer. Same windows OS. I installed the exact same sony media importer and th

  • Object key for PORDER (document links, table DRAD)

    Hi, the object key for PORDER entries in table DRAD looks like: 000003054845O00000000000020000000020000 what i know: character 1 to 12: ordernumber (AFKO-AUFNR) character 18 to 23: sequencenumber (AFVC-PLNFL) character 24 to 27: operationnumber (AFVC

  • How to zoom the .pdf file to 50% when opening

    I do have a report which is in Adobe .PDF format and it will open from a link through a .htm page. Now, I want to make this .PDF open in 50% view of the Acrobat reader. How to do this?

  • Win7 install does not see new hard drive (640gb Samusung) on MacBook Pro

    Replaced MBP 5,4 (mid 2009) hdd with a Samsung HM641JI 640gb drive. OS X installation went fine using SL install disk, updated software to 10.6.4. Problem is with Windows 7 installation using Boot Camp. Partition is created (tried 32 to 300 gb). Wind