Posts Tagged ‘ DateTime ’

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…

 

%d bloggers like this: