I want to read the time from excel and then display in message box that these employees came late to the office… ? What will be syntax for the IF condition part??
Can you show us how the excel file look like? ( try to upload it ) in order for us to see
For instance, it has a column name as ‘In Time’ and values are ‘9:00:00’, ‘9:15:00’… so I want that in if condition I should be able to check if time is > 9:00:00… what is the syntax for this?
Thanks for your reply. My data has two different columns for Date and Time. Attaching data set snapshot for your reference.
I tried these two logics in If condition, but no luck !
DateTime.Parse(row.Item(“In Time”).ToString) > DateTime.Parse(“09:00:00”)
I will try to do the following:
- make new string _dateTimeString = date + " " + inTime
- convert _dateTimeString var to dateTime type like in the following link- > Convert a string to Date time variable
Hope you are doing well,
you can try this
- (DateTime.ParseExact(DateTime.Now.ToString(“MM/dd/yyyy HH:mm:ss”), “MM/dd/yyyy HH:mm:ss”, System.Globalization.CultureInfo.InvariantCulture)-DateTime.ParseExact(Cdate(row(“In Time”).ToString).ToString(“HH:mm:ss”), “HH:mm:ss”, System.Globalization.CultureInfo.InvariantCulture)).TotalHours.ToString()