zoukankan      html  css  js  c++  java
  • Add/Subtract Days to a Date and pass to a Record Object

    Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

    Add/Subtract Days to a Date and pass to a Record Object

    This article has been updated.(again 14th April 2009)
     
    Dates can be a bit of a challenge. This article explains three points:
    • how to convert a record’s date field value into a JavaScript Date object.
    • how to add/subtract days to a JavaScript Date object. 
    • how to pass a JavaScript Date object to a record’s date field value.

    1. How to convert a record’s date field value into a JavaScript Date object
    var cardate = new Date (carRecord.vcar_DateMade);

    Please read the article "Validation of Dates" which discusses the parsing rules that need to be followed to succesfully create a date object.

    2. How to add/subtract days to a JavaScript Date object
    cardate.setDate(cardate.getDate() -14 );

    3. How to pass a JavaScript Date object to a record’s date field value
    // myRecord is a communication record (already created)
    myRecord.Comm_ToDateTime = cardate.getVarDate() ;

    That’s it!! Its easy once you know!
  • 相关阅读:
    c++错误崩溃3
    c++崩溃错误2
    c++多线程崩溃错误1
    MySQL UNSIGNED
    2PC和3PC
    proxy-target-class="false"与proxy-target-class="true"区别
    Spring MVC processing flow
    Spring中自动装配的模式
    Spring中BeanFactory和ApplicationContext的区别
    什么是Spring
  • 原文地址:https://www.cnblogs.com/janmson/p/1547555.html
Copyright © 2011-2022 走看看