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

excel
email

#1

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!!


#2

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


#3

Capture Please find the error screenshot.


#4

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


#5

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.


#6

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


#7

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


#8

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()))