Future Date

Hi Team,

I have a simple date picker. <input type=“date” id=“date” name’“datepicker”>

  1. If i choose tomorrow/future date it should display a message box that is a future date.
  2. Currently displaying as 01/01/2021 want in format like 01/Jan/2021
    need a sample code

Hi @Balan,

Considering your second point, if you want 01/01/2021 the date to look like this → 01/Jan/2021
what you can do suppose if a varaiable say Var has the value → 01/01/2021
then, you can write something like

Datetime.ParseExact(Var, “dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MMM/yyyy”)

Try This.

1 Like

Hi @Balan

I did not understand with the first point

Like how is selected is it done by user or not had to check whether the future or tommorow date is selected?

@ Shikhar how and when to call this. For instance my code is

Assuming i am placing ur code inside a function say
function test()
{
Datetime.ParseExact(Var, “dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MMM/yyyy”)
}

How and when to call this ? i am new to js. need your help

@Nived once i choose a date from date picker. Assume tomorrow date it should say its future date.

Hi @Balan

Can u share it’s screenshot of date picker and how it looks after selecting date?

Hi @Balan

Take one assign CurrentDate =Datetime.ParseExact(Var, “dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MMM/yyyy”) you will get Today date.

Take IF condition,

if(CurrentDate<Datepicker Variable)
{
Messagebox/WriteLine(“Future Date”)

}

Thanks
Latika

@shikhar i missed my code. my code is - input type=“date” id=“ScanDate” name=“ScanDate”

how to call ur code here?

Hi @Balan

Did not understand what u said

Can u share the screenshot of date picker after selecting date

Currently i have extracted

  1. Todays date
  2. Picked the date from the date picker

Format what i am getting is different hence i am unable to compare and find which date is greater. For instance todays date format is (MM/dd/yyyy) and date what i picked from date picker is in (2021-01-14). All happening inside the html file. CurrentDate =Datetime.ParseExact(Var, “dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MMM/yyyy”) you will get Today date.
Will this line of code work inside html page ?
Suggest how to proceed. Based on these 2 format IF condition not working correctly.

Working fine.

Future date validation is working fine.
Still i am unable to find a solution for the below one. I choose a date in date picker it is displaying in below format
12-01-2021 want to change to the below format
12-Jan-2021 - how to convert to this format

You can check this workflow for date conversion,DateConversion.xaml (5.7 KB)

Thanks
Latika

My date picker code is inside a html page. Do u mean to say that once i choose a date in date picker i need to invoke this xaml from html page? If so how to do that ?

Can you please share screenshot of html page,

Once you have chosen the date, take Get text activity and read that date and use the conversion provided in xmal,

Thanks
Latika

Yes i can understand that gettext and ur code provided. My question is its a pure Html file
how to use gettext inside html file ? I am new to this. Ex my code
input type=“date” id=“ScanDate” name=“ScanDate” value=“Submit”>
In the above code we get the date picker
image
In the sample pic its 01/12/2021 instead it should set as 01-Dec-2021.