Preview:
//str date2Str(date date, int sequence, int day, int separator1, int month, int separator2, int year [, int flags = DateFlags::None])

    date currentDate = today();
    str s;
    int iEnum;
    s = date2Str
    (currentDate, 
        321,
        DateDay::Digits2,
        DateSeparator::Hyphen, // separator1
        DateMonth::Digits2,
        DateSeparator::Hyphen, // separator2
        DateYear::Digits4
    );
    info("Today is:  " + s);

/** Example Infolog output
Message (12:36:21 pm)
Today is:  2009-01-13
**/

////////////////////////////////////////////////////////////////////////////////

sql_fromDate =  date2str(fromDate,321,DateDay::Digits2,DateSeparator::Hyphen,DateMonth::Digits2,DateSeparator::Hyphen,DateYear::Digits4);

/** output
2018-09-20
**/
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter