Hello everyone,
I have two variables named TodayDate and YesterdayDate declared like in the following image:
I want to add this variables in the Export to Datatable activity
but the error says:
Compiler errors encountered processing expression "YesterdayDate".Option Strict On disallows implicit conversions from 'String' to 'Date'
As per I understand I should convert the TodayDate and YesterdayDate in Date format. Any idea how to do that?
Hi,
You can use
DateTime.ParseExact(variablename,“dd-MM-yyyy”,System.Globalization.CultureInfo.InvariantCulture)
syntax to convert string to datetime.
Thanks,
Bhagyashri
Gokul001
(Gokul Balaji)
August 10, 2022, 12:33pm
3
HI @Xheni_Xhensila
How about this expression?
DateTime.ParseExact(Now.Tostring,"dd-MM-yyyy hh:mm:ss",System.Globalization.CultureInfo.InvariantCulture).Tostring("yyyyMMdd")
Regards
Gokul
Hey!
Try this:
Assign strToday = Now.ToString("yyyyMMdd")
Assign strYesturday = Now.AddDays(-1).ToString("yyyyMMdd")
Try this and let me know
Regards,
NaNi
Gokul001
(Gokul Balaji)
August 10, 2022, 12:39pm
5
Update Expression @Xheni_Xhensila
Assign TodayDate = DateTime.Now.ToString
Assign YesterdayDate = DateTime.Now.AddDays(-1).ToString
DateTime.ParseExact(TodayDate,"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).Tostring("yyyyMMdd")
DateTime.ParseExact(YesterdayDate,"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).Tostring("yyyyMMdd")
For Reference
Date Expressions.xaml (6.4 KB)
Regards
Gokul
still giving errors becasue as I mentioned before I need to use it in the Export Activity which accepts only Date in the format yyyy,MM,dd
Note: Before to use YesterdayDate and TodayDate the values in Export activity were replaced with static information 2022,12,01 and 2023,12,30
it was like this before and it used to work perfectly But I need to replace the From with YesterdayDate and Till with TodayDate
Hello @Xheni_Xhensila
I think you can use Modify Date activity.
Please watch the below video. It can help to resolve your issue.
uhmmm so interesting, Thank you for sharing. I already fixed. Date.ParseExact(YesterdayDate,“yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy,MM,dd”)
yes, you can do it like using the expression as well…
system
(system)
Closed
August 13, 2022, 6:04pm
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.