i have to check whether today is sat or sunday … if it is sat after 10:30AM i want monday date… if it is below 10:30 i want to put friday date…
- if it is sunday… i want monday date
i have to check whether today is sat or sunday … if it is sat after 10:30AM i want monday date… if it is below 10:30 i want to put friday date…
Hi @katta_nikhil ,
Can you try this.
str = Now.Tostring("dd-MM-yyyy HHmm")
outputDate = If(DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).ToString("ddd")="Sat",If(
CInt(DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).ToString("HHmm"))>=1030,
DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).AddDays(2).ToShortDateString,
DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).AddDays(-1).ToShortDateString),
If(DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).ToString("ddd")="Sun",
DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).AddDays(1).ToShortDateString,Nothing))
Thanks!
Refer the below Workflow file for the required output.
Sequence6.xaml (12.1 KB)
Hope it helps!!
Regards,
CAN U PLEASE recheck and send me… it is not working
@katta_nikhil
Is the file not opening for you.
Regards,
no it is opening but iam not getting the required output
can u add for today scenerio… becoz today is thursday right … so i want today date
If it is saturday it will give you the required output. But today is not saturday right so it won’t print anything.
Regards,
yeah , it right but can u add today scenario also … if today is not sat or sunday … then it has to give today date itself
Can you try this.
str = Now.Tostring("dd-MM-yyyy HHmm")
outputDate = If(DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).ToString("ddd")="Sat",If(
CInt(DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).ToString("HHmm"))>=1030,
DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).AddDays(2).ToShortDateString,
DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).AddDays(-1).ToShortDateString),
If(DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).ToString("ddd")="Sun",
DateTime.ParseExact(str,"dd-MM-yyyy HHmm",system.Globalization.CultureInfo.InvariantCulture).AddDays(1).ToShortDateString,str))
This query will give a today date
Thanks!
my senior dev wants only understand logic…
try this:
currentDate = DateTime.Now
desiredDate = If(currentDate.DayOfWeek = DayOfWeek.Saturday,
If(currentDate.TimeOfDay >= New TimeSpan(10, 30, 0),
currentDate.AddDays(2),
currentDate.AddDays(-1)
),
If(currentDate.DayOfWeek = DayOfWeek.Sunday,
currentDate.AddDays(1),
Nothing
)
)
Hope it helps.
Use this below condition in the else block
currentDateTime.AddDays(0)
It will give the current date of today.
Note: Shared the workflow for reference
Sequence6.xaml (13.4 KB)
Regards,
thank you sooooo muchhh
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.