Sign in to follow this  

[.net] Date/time

This topic is 4548 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to find a command that would enter the current date and time into a displayed string. As in:
"< div >The time is: " + ????? + "< /div >"
Anyone know how to do this?

Share this post


Link to post
Share on other sites
Be careful with the Microsoft.VisualBasic namespace. It's mainly there to help you migrate vb6 code to .NET. Yes, it does work but MS strongly suggests you use the *real* framework classes/functions: in particular the Microsoft.VisualBasic.Compatibility namespace should be avoided. The namespace Microsoft.VisualBasic contains a lot of 'global' methods to give that vb6 feel..

Perhaps Lenolian's rating should go++ as well[smile]

Cheers

Share this post


Link to post
Share on other sites
If you want to do this in the "real" .Net way, you should be using the DateTime structure. It has a ton of useful string formatting functions, depending on what format you are looking for. What I usually use is "DateTime.Today.ToShortDateString()"

Share this post


Link to post
Share on other sites

This topic is 4548 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this