Extract days from each dates in a datetime array


#1

I have an array DateList = {New DateTime(2018, 01, 01),New DateTime(2018, 01, 15),New DateTime(2018, 02, 09), New DateTime(2018, 05, 28), New DateTime(2018, 07, 04)}
how do i get each day e.g wednesday, thursday, friday etc from each of the dates. I get the error "allows strict on disallows implicit conversions from string to integer.


#2

Hi @Olaoluwa,

I hope you created the array(object)
If yes need to use this code
string dayname=convert.TodateTime(DateList(0)).ToString("dddd")

If you created array(DateTime)

If yes need to use this code
string dayname=DateList(0).ToString("dddd")

Use for each in the for each -> type need to mention as DateTime

Regards,
Arivu


#3

thats exactly what i have been doing but im still getting the error… company holidays is the datetime array. i attached a screenshot to see.


#4

Can you share your xaml file I ll check and update you


#5

Main.xaml (7.7 KB)


#6

HI @Olaoluwa,

Use this xaml file

Main (17).xaml (7.8 KB)

Regards,
Arivu


#7

the files look the same what did i do wrong?


#8

oh i see my mistake now. Thank you.


#9

@Olaoluwa
You can get directly the day by using
DateTimeVariable.DayOfWeek.ToString

Regards,
Mahesh