somya177
(somya)
June 18, 2018, 1:03pm
1
Hii,
My Excel sheet column is having date in US format but when my BOT after Reading the excel writes it into Webpage TextField it is Writing in Indian Format with time as 00:00:00 which i not there in excel sheet ,it only has date in US Format.webpage is throwing error.
My UiPath is inside citrix Environment.
Please help
sarathi125
(Parthasarathi)
June 18, 2018, 1:08pm
2
Hi,
which is your webpage expected format, Indian format or US format?
sarathi125
(Parthasarathi)
June 18, 2018, 1:12pm
4
Hi,
Get your date from the excel as string and convert it as date in assign activity as below
Assign to a date variable: Convert.ToDateTime(dt.Rows(0)(“YourDate”).ToString).Date
Then while feeding it in your website convert your date as below
DateTime.ParseExact(convertedDate.ToString(“MM/dd/yyyy”), “MM/dd/yyyy”, Nothing).ToString(“dd-MM-yyyy”)
2 Likes
while type into date into field define date format which ever you want
example: date.tostring(“dd/MMM/yyyy/hh/ss”)
somya177
(somya)
June 18, 2018, 1:37pm
6
i am extracting it as row(2).tostring(“yyyy-mm-dd”) but it is throwing an error that implicit conversion not allowed from string to int.
sarathi125
(Parthasarathi)
June 18, 2018, 1:46pm
7
Try like this,
convert the table value first to date datatype
Convert.ToDateTime(row(2)(“YourDate”).ToString).Date
then convert it to your target format as below
DateTime.ParseExact(convertedDate.ToString(“MM/dd/yyyy”), “MM/dd/yyyy”, Nothing).ToString(“yyyy-mm-dd”)
somya177
(somya)
June 18, 2018, 1:57pm
8
i can´t give any specific date in YourDate as My Bot will be extracting the Highest date from the excel column…i.e. it can 30 or 31
sarathi125
(Parthasarathi)
June 18, 2018, 2:04pm
9
then you will get the highest date as a string right, convert that to date then proceed the second step
somya177
(somya)
June 18, 2018, 2:06pm
10
Hi ,
I have stored my Highest date as
MaxDate=readDT.AsEnumerable().Max(Function (a) DateTime.Parse(a.Item(“Trade Date”).ToString)).ToString
sarathi125
(Parthasarathi)
June 18, 2018, 2:12pm
11
Assign Activity:
Date dateValue = Convert.ToDateTime(MaxDate.ToString).Date
then convert it to your target format as below
DateTime.ParseExact(dateValue .ToString(“MM/dd/yyyy”), “MM/dd/yyyy”, Nothing).ToString(“yyyy-mm-dd”)
sarathi125
(Parthasarathi)
June 18, 2018, 2:15pm
13
create a variable as dateValue with DateTime Datatype.
Share your max date value and your desired format, it will be easy to understand
somya177
(somya)
June 18, 2018, 2:18pm
14
for converting it into target format i again need to take a variable in assign as datetype
and pass it like this
finaldate=DateTime.ParseExact(dateValue .ToString(“MM/dd/yyyy”), “MM/dd/yyyy”, Nothing).ToString(“yyyy-mm-dd”)
sarathi125
(Parthasarathi)
June 18, 2018, 2:19pm
15
Hi,
Yes, but If you are using Type Into activity then you can do the final conversion inside that without having another variable ‘finalDate’. Its not required.
sarathi125
(Parthasarathi)
June 18, 2018, 2:25pm
16
the above working solutions converts the date as below
Input Max Date : 06/18/2018
Final Converted Format : 2018-06-18
somya177
(somya)
June 18, 2018, 2:27pm
17
it converted but output should be 2018-06-12
but BOT is Writing 2018-00-12
Is it because my UiPath and webpage both are in citrix??
sarathi125
(Parthasarathi)
June 18, 2018, 2:28pm
18
DateTime.ParseExact(dateValue .ToString(“MM/dd/yyyy”), “MM/dd/yyyy”, Nothing).ToString(“yyyy-MM -dd”)
in the format change mm to MM
use get date fields activity then give input of your date , define the variables like dd , mm, yyyy then finally construct in required formate