How to get Time from Excel and print in body of SMTP mail message

I am trying to get the time(InTime) information(HH:MM) from excel and print the information in body of the SMTP mail message. Am getting Compiler error as option strict on disallows implicit conversions from ‘string’ to ‘integer’. I have defined InTime as String.

Can someone help me how to fix this issue. Thanks!!

Can you tell me which line is giving error ? Can you paste the screen shot or code ?

Capture Please find the error screenshot.

I think it is due to data type of InTime shich shiould be System.DateTime

Hi @skini76,

Thanks for the response, as per my requirement am getting the data from excel and sending the mail to concern person. If i change the data type to system.DataTime am getting Compiler error as option strict on disallows implicit conversions from ‘date’ to ‘string’.

Thanks.

while composing the mail convert the time to string ie inTime.toString

Am getting an exception error. " Invalid cast from ‘Double’ to ‘DateTime’ ".

Now i got the output. Thanks for you support.

I used this code and got working for me.
DateTime.FromOADate(Convert.ToDouble(row.Item(“OT”).ToString()))

1 Like