winningvish
(Vishnu Vardhan )
November 5, 2019, 5:08pm
1
Hi Everyone,
I am trying the compare the Date Values from the Excel which is in the format of 25-SEP-19 (Date Format)
and the extracted date as 25 Sep 2019 (String)
The Output from the Log messages
Can anyone please advise how to convert the extracted value (25 Sep 2019) can be matched to Excel Date Value (25-SEP-19)
Much appreciated for your kind help in advance.
Regards
Vishnu
lakshman
(Ganta lakshman)
November 5, 2019, 5:13pm
2
@winningvish
You can convert by using below expression.
Convert.ToDateTime(row(“TRANSACTION_DATE”).ToString).ToString(“dd MMM yyyy”)
winningvish
(Vishnu Vardhan )
November 5, 2019, 5:49pm
3
Hi @lakshman ,
Thank you so much for your quick reply. Now its possible to change the date format.
Even though I have changed the date type I am unable to get the matched records from the Data table by using the below select method. Would you please guide me, am I doing something wrong.
I am reading the same from excel as below
Output is Source Contains No Data Rows Even though we matched exactly.
lakshman
(Ganta lakshman)
November 6, 2019, 1:42am
4
@winningvish
It seems like your select query only wrong. Single quotes are missing for first two column name values in that select query.
sarathi125
(Parthasarathi)
November 6, 2019, 1:54am
5
@winningvish ,
The date you are passing is not in the same format as in the datatable.
Change this dd MMM yyyy to dd-MMM-yyyy and check once. Check the amount value as well.
1 Like
winningvish
(Vishnu Vardhan )
November 6, 2019, 7:02am
6
Hi Lakshman,
Its worked as below even there is no Single Quote for the [OTHER NUMBER]
Smart_DT.Select(“[AMOUNT] = '”+PaymentAmount.ToString+“’ AND [OTHER NUMBER] = “+EntityID+” AND [TRANSACTION_DATE] = '”+TreatmentDate.ToString+“'”).CopyToDataTable
It seems whatever the value you are converting needs to be quoted in Single
winningvish
(Vishnu Vardhan )
November 6, 2019, 7:03am
7
Hi @sarathi125 ,
Thank you for your reply. Now Its solved
3 Likes
system
(system)
Closed
November 9, 2019, 7:03am
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.