Working with DateTime

I am just starting with some code:

This is the code block inside my button click event handler. So, if the button is clicked the result is:

Using the method ToShortDateString just returns the date, while ToShortTimeString returns just the actual time.

Now I am curious what result the ToLongDateString would give me:

I still get the date, but now the day is being displayed as well. Nice!

There are many possibilities how to use Date or Time strings. To give an example, what if I am not interested in today’s date, but in five days from now?

I simply add those five days in my code:

You can also add hours, minutes, etc.

I am sure you can do a lot of fun stuff with that. Let’s see. I want to know how old I am right now. How many days, how many hours, etc.

Now, besides the fact that this is a little depressing for me, the result is very cool:

Apparently I am 15364 days old, 11 hours, 38 minutes, 50 seconds, and a few milliseconds.

I definitely will continue learning as much as possible about coding, programming and more. Can’t wait to write my very own app. The idea is there… waiting to be written in code, waiting to be developed.


To be continued…


  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: