The following string deliver 12:00 with the appropriate date.   I need assistance with the code to deliver DateTime Now()

string htmlBody = "<font color=\"black\"><font face=\"arial\">Date: " + DateTime.Parse(Dates.Text)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

With the parse method you can use the tostring method to format the field value any way you want... if you are sure it will always be a valid datetime value
BOEING39Author Commented:
What would the format look like in this example?
käµfm³d 👽Commented:
I think a clarification of what you mean by "I need assistance with the code to deliver DateTime Now()," but my first guess is that you are asking for something like:

string htmlBody = "<font color=\"black\"><font face=\"arial\">Date: " + DateTime.Now.Date.ToString();
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

BOEING39Author Commented:
I am have issues with two sections of this page.    

1.  Parameters:

cmd.Parameters.AddWithValue("@Dates", DateTime.Now.Date.ToString()Dates.Text);

2.  e-mail portion:

string htmlBody = "<font color=\"black\"><font face=\"arial\">Date: " + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss")
Gustav BrockCIOCommented:
The first should probably read:

cmd.Parameters.AddWithValue("@Dates", DateTime.Now);

The second looks OK. What's the issue?


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SAMIR BHOGAYTAFreelancer and IT ConsultantCommented:
hi.. this are the formats of date in c# try this

Specifier       Description                               Output
d               Short Date                               08/04/2007
D               Long Date                               08 April 2007
t               Short Time                               21:08
T               Long Time                               21:08:59
f               Full date and time                       08 April 2007 21:08
F               Full date and time (long)         08 April 2007 21:08:59
g               Default date and time                08/04/2007 21:08
G               Default date and time (long)       08/04/2007 21:08:59
M               Day / Month                                  08 April
r               RFC1123 date                                  Sun, 08 Apr 2007 21:08:59 GMT
s               Sortable date/time                         2007-04-08T21:08:59
u               Universal time, local timezone       2007-04-08 21:08:59Z
Y               Month / Year                                  April 2007
dd               Day                                                    08
ddd               Short Day Name                         Sun
dddd       Full Day Name                         Sunday
hh               2 digit hour                                  09
HH               2 digit hour (24 hour)                   21
mm               2 digit minute                                  08
MM               Month                                           04
MMM       Short Month name                         Apr
MMMM       Month name                                  April
ss               seconds                                           59
tt               AM/PM                                           PM
yy               2 digit year                                  07
yyyy       4 digit year                                  2007
:               seperator, e.g. {0:hh:mm:ss}          09:08:59
/               seperator, e.g. {0:dd/MM/yyyy}  08/04/2007
BOEING39Author Commented:
This resolved my question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.