I want to select 4 timeranges w.r.t. current hour in below downarrow..I've put this code..but it's not giving desired results. If anyone can help? it's urgent. I need only logic..for both AM and PM including

dateTimeNow+" "+now.AddHours(-1).tostring(“h:00 tt”) + " - "+ now.tostring(“h:00 tt”)
image

if it’s 11:10 PM,
I want
10:00-11:00 PM
9:00-10:00 PM
8:00-9:00 PM
7:00-8:00 PM

1 Like

Hi

Hope these steps would help you resolve this

Use a assign activity like this

str_output =

Datetime.Now.AddHours(-1).ToString(“hh:00 tt”)+” - “+ Datetime.Now.ToString(“hh:00 tt”)+Environmen.NewLine+
Datetime.Now.AddHours(-2).ToString(“hh:00 tt”)+” - “+ Datetime.Now.AddHours(-1).ToString(“hh:00 tt”)+Environment.NewLine+
Datetime.Now.AddHours(-3).ToString(“hh:00 tt”)+” - “+ Datetime.Now.AddHours(-2).ToString(“hh:00 tt”)+Environment.NewLine+
Datetime.Now.AddHours(-4).ToString(“hh:00 tt”)+” - “+ Datetime.Now.AddHours(-3).ToString(“hh:00 tt”)

If you want it in separate stringvariable then remove that environment.Newline and have it in separate variable

Cheers @anjasing

1 Like

thank you :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.