Click here to Skip to main content
15,073,454 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi all,
I am new in Windows Phone development.
I want to know how to set and get the time.
How to show current time.

1 solution

This is so simple to do for need to try it by yourself...Do you google it?If you expect code from here then it willn't increase your coding skill.Ok,then lets see..

DateTime.Now.ToString() will show you current time.You can use different foramts for that..suppose if you use DateTime.Now.ToString("hh:mm:ss")then it will display time as hour,minute,second format.If you use DateTime.Now.ToString("hh:mm:ss tt") then it will represent whether it is AM or PM.There are lot of articles in MSDN for it..see i give you an simple clock example code for reference that you can understand easily how to build your application..[^][^]
Dave Crump 20-Aug-12 14:12pm
Thank you for the reply and help,
I did a lots of research about coding. I am also so much volunteer to learn.

It was not my request. My request is, that set the time by the user with scrolling a TextBox Control in a scrollview container.

I tried many ways to get the String's Date and time but, no success.

Thank in advance
ridoy 20-Aug-12 14:32pm
Set the time?Is it like alarm application?and what you actually need?how to set time or how to get string representation of date and time?
Dave Crump 20-Aug-12 19:16pm
Yes, exactly like Alarm Setting.
The scenario is like that; User has to set the time, for example like 12:30.
I have to get "12:30" for later use. Because I have to search based on the setted time.
ridoy 21-Aug-12 2:23am
See some alarm tutorial from below link...see how setted time is operated there..
Dave Crump 25-Aug-12 1:51am
Thanks Ridoy, it really helped me.
ridoy 25-Aug-12 2:00am
glad to help you..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900