How to convert Date format in Deluge Script

How to convert Date format in Deluge Script

To convert the date format from "DD-MMM-YYYY" to "YYYY-MM-DD", change the string with first format to date. Then convert that date object to a string specifying the second format. The below is the sample function which converts the format of the date to "YYYY-MM-DD" and return it as a string. Please refer to it. 


  1. string changedateformat(string inputdate) //input date is string in format "DD-MMM-YYYY". for eg. 10-Sep-2010.
  2. {
  3.     dt = input.inputdate.toDate("dd-MMM-yyyy"); // converting input string to date object specifying its format.
  4.     dt1 = dt.toString("yyyy-MM-dd");   // Now we convert the date object to string with our required format.
  5.     return dt1;   // returning the string object.
  6. }

    • Related Articles

    • How to convert Date format in Deluge Script

      To convert the date format from "DD-MMM-YYYY" to "YYYY-MM-DD", change the string with first format to date. Then convert that date object to a string specifying the second format. The below is the sample function which converts the format of the date ...
    • How can I get the values entered for certain fields via Deluge script?

      How can I get the values entered for certain fields via Deluge script?
    • How can I get the values entered for certain fields via Deluge script?

      Many a times, when you are developing an application, you may need to get the value(s) entered for the fields in the form. To get the particular value, you can do so in Deluge Script, using the statement: input.<Field Name>For ex, if you would like ...
    • How can I update records in a form using Deluge Script?

      About the application  You can fetch and update records from a form using Deluge script.  Let us illustrate this with the help of an example. The application Library Manager has two forms: Books - To enter the details about each book with fields ...
    • Defining Deluge Functions

      Functions are custom hooks written by action developers that are invoked by Zia at various points during an action's execution. The conversational flow and the execution of an action are determined by the functions defined for that action.  The ...