set financial year extract from given date

how can i write if condition to set my financial year?     [if FormatDateTime([MeetingDate], 'MM')>3 concat(FormatDateTime([MeetingDate], 'yyyy'),'-',FormatDateTime([MeetingDate], 'yyyy')+1) else concat(FormatDateTime([MeetingDate], 'yyyy'),'-',FormatDateTime([MeetingDate], 'yyyy')-1) ]   this code is giving me an error.  
1 answers

I assuming the Fiscal start on April 1 to end on March 31s the next year then assuming you need output like FY2023-24 or FY2024-25 you can do the below


    // Get the year and month from your Date
 var $Year = parseInteger(formatDateTime($MyDate, 'yyyy'))
    var $Month = parseInteger(formatDateTime($MyDate, 'MM'))

// Check if the date is not empty
if $MyDate != empty then
    // Determine the fiscal year string based on the month
    if $Month >= 4 then
        // Fiscal year starts this year
        'FY' + toString($Year) + '-' + substring(toString($Year + 1), 2)
        // Fiscal year started last year
        'FY' + toString($Year - 1) + '-' + substring(toString($Year), 2)

You can convert the return types based on your needs. Hope this helps you.