How to use specific DateTime format to pass API

Hi all

In Post API calls, i passed a input as a data table and one of the column type is datetime and the value is current date with “yyyy-MM-dd” format. how to pass the input for this type.
Can anyone please let me know?

Hi @Divya.mind24 ,

  1. Create a DataTable with the required columns.
  2. Add data to the DataTable, ensuring that the datetime column is formatted correctly.
  3. Convert the DataTable to JSON format.
  4. Include the JSON data in the body of your HTTP Request.

Hi @Divya.mind24 ,

Use a For Each Activity and iterate through the rows,
Use an Assign activity to update the column with date value in the format you need it to be using the expression,
DateTime.ParseExact(DateTime.Now.tostring(), “yyyy-MM-dd”,System.Globalization.CultureInfo.InvariantCulture)

Hope this helps you out.

Happy automating…!

Thanks,
Gautham.