Forum Moderators: open

Message Too Old, No Replies

System Date and Time

Adding Date & Time stamp to email message body

         

PhotoJoe

11:22 pm on Jul 21, 2008 (gmt 0)

10+ Year Member



I have created a form for users to fill out. When they click on the button labeled Submit.

I have my VB behind code take all the fields and create an email message. It is working fine. But I would like to add a date & time stamp to the email. What I would like to do is get the current date & time from the server that is hosting the web page. Then convert it to a string variable that I can insert into my message string variable that I use for my email content. My problem is I don't know which class to use to get the information from the server. I have been searching the help files within VWD but can't seem to find what I need.

Right now I'm using the following namespace imports:

Imports System.Net.Mail

Imports System.IO

Thanks
PhotoJoe

LeoXIV

12:41 am on Jul 22, 2008 (gmt 0)

10+ Year Member



it is DateTime.Now

PhotoJoe

7:17 am on Jul 22, 2008 (gmt 0)

10+ Year Member



Thanks LeoXIV, that was just the clue I needed to find the information I was looking for.

Here is the code I came up with, just incase someone else needs this information in the future when doing a search.

Dim dt As DateTime = DateTime.Now
Dim dt_str As String = dt.ToString("MM/dd/yyyy HH:mm:ss")

I then just added the dt_str to my message_str

Thanks again,

Photo Joe