I am working with DateTime data which are stored in the Buddhist year.
Actually, there is a simple solution to convert the Buddhist year to the Gregorian year.
{
"$dateSubtract": {
"startDate": {
"$dateFromString": {
"dateString": "$receive_date",
"format": "%d/%m/%Y %H:%M"
}
},
"unit": "year",
"amount": 543
}
}
It works most of the time but it throws an error if `` receive_date` is 29/2/2567 because 2567 in the Gregorian year is not a leap year but it is in the Buddhist year.
Do you have any suggestions to resolve this issue?