88
Views
4
Comments
Dateformat yyyy-mm

Hi Team,

I need to pass only "2022-02" to fromdate variable which is of  data type date from FromdateOfPreviousAddress ("2022-02-01") of data type date, i used the below logic


fromdate=TextToDate(FormatDateTime(FromdateOfPreviousAddress,"yyyy-MM")) 

but fromdate  returns only null date

2020-11-25 10-45-32
Mostafa Othman
Champion

Hello R. Kar, 

To save value of data type date or dateTime you have to save a complete and correct format of date consists of day, month and year. 

For your case I may suggest to safe date as firt day of each month for example for "2022-2" save it as "2022-02-01" then while you displaying value you can display it again as “2022-02"

As another solution you can save month in a separate column of type integer and year in separate column of type integer then concatenate them for display or create date variable equal NewDate(year, month, day) 


UserImage.jpg
karthimani R

Hi Mostafa, 

Its not for displaying,need to pass that date to an api with the format yyyy-mm which is of data type date

2020-11-25 10-45-32
Mostafa Othman
Champion

You will not able to send date in this format of month and year only. 

If Json attribute of type date so you need to send full date day, month and year. 

If its string you can send string of month and year only

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

Remove the text to date function from your expression. yyyy-MM formatted text cannot be converted back to date. You need to pass it as string to the API.

Regards,

Daniel

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.