Re: importing dates from excel to sharepoint list
Hi @sherif77
The syntax and function for addDays('1899-12-31',int(item()['Expiry Date']),'YYYY-MM-DD') seem off.
How many days are you trying to add (or subtract) from the date "1899-12-31"?
The functions addDays() takes the # of days as an argument. Your function may not work for a few reasons:
1) the int function will not convert a date with format 'YYYY-MM-DD' to an integer since 'YYYY-MM-DD' is not a valid non-integer number.
2) the argument int(item()['Expiry Date']),'YYYY-MM-DD' is not a valid number (+ or -) therefore the addDays function will not work.
3) Not sure if this is on purpose but 'YYYY-MM-DD' will not return a valid date format. The correct syntax is 'yyyy-MM-dd'
4) You need a formatDateTime in your function if you explicitly want to set a date format.
Some tips.
To explicitly format your expiry date then use the syntax below
dayOfMonth(formatDateTime(utcNow(),'yyyy-MM-dd')) = 19th day of the month
If you want to get a specific number of days forward or backward from '1899-12-31' then use this syntax. Use the dayOfMonth function to get a valid day.
addDays('1899-12-31',dayOfMonth(formatDateTime(utcNow(),'yyyy-MM-dd')) = 1900-01-19T00:00:00.0000000
Cheers,
Aman
------------------------------------------------------------------------------------------------------
If my post helps you with your problem or answers your question, please mark it Solved or Answered. This helps anyone with similar challenges. If you like my response, please give it a Thumbs Up.
------------------------------------------------------------------------------------------------------