Welcome to WebmasterWorld Guest from

Forum Moderators: ocean10000

Message Too Old, No Replies

System Date and Time

Adding Date & Time stamp to email message body

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

New User

10+ Year Member

joined:July 12, 2008
posts: 12
votes: 0

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


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

Full Member

10+ Year Member

joined:June 18, 2004
votes: 0

it is DateTime.Now
7:17 am on July 22, 2008 (gmt 0)

New User

10+ Year Member

joined:July 12, 2008
votes: 0

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