WordPress.org

Forums

Calculated Fields Form
[resolved] Current date (2 posts)

  1. selett
    Member
    Posted 1 year ago #

    Hello,

    I would like to use the current day in a function.

    For example :
    (function(){if (fieldname11 - "current date" < 730){return cdate(fieldname10+1460);}else{return cdate(fieldname11+730);}})()

    How to do this ?

    Thanks for the help
    Best regards

    Selett

    http://wordpress.org/plugins/calculated-fields-form/

  2. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Selett,

    This is the solution:

    (function(){
    var d = new Date();
    if (fieldname11 - d.valueOf()/86400000 < 730){
    return cdate(fieldname10+1460);
    }else{
    return cdate(fieldname11+730);
    }
    })();

    Thank you for using the plugin!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Calculated Fields Form
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.