I am having a problem in converting string value taken from a DATE TextBox (Get Text). I created the variable as a generic variable - the value it gets is in this format - “dd\mm\yyyy”. couldn’t create the variable as DateTime variable.
I need to convert it into “DateTime” format in order to check whether this date (dd-mm-yyyy) is more then 30 days away from today.
I tried doing several things but it wasn’t successful - Assign dateVar=DateTime.FromOADate(timeValue) datevar.ToString(“HH:mm:ss”)
Hi @shachar
If the datetime format you are getting from get text is in this format dd\MM\yyyy assigned to timeValue variable of type generic
use like this buddy dateVar = Datetime.ParseExact(timeValue.ToString,“dd\MM\yyyy”,System.Globalization.CultureInfo.InvariantCulture)
or if that get text value is in this format dd-MM-yyyy assigned to timeValue variable of type generic
use like this dateVar = Datetime.ParseExact(timeValue.ToString,“dd-MM-yyyy”,System.Globalization.CultureInfo.InvariantCulture)
now you have a datetime variable dateVar
and to find whether it is more than 30 days away from now
use a if condition like this dateVar>now.AddDays(30)
actually timevalue is keyword that gives us value of timespan…
are we trying to convert a timespan to date…
or kindly change the variable name from timeValue to different name and try buddy
Cheers @shachar
lets do one thing @shachar
lets check how the value of timevalue is getting displayed with writeline activity to check the format once.
after the get text pass that value to writeline activity and share the screenshot of that output panel with timevalue been displayed
and we need to mention like this buddy dateVar = Datetime.ParseExact(timeValue.ToString,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)
where as you have like, with backslash and value is in front slash