Click here to get back home

Date to string

 HomeNewsGroups | Search | About
 microsoft.public.smartphone.developer    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Date to string Park2 01-31-2006
---> Re: Date to string Peter Foot [MVP...01-31-2006
Get Chitika Premium
Posted by Park2 on January 31, 2006, 6:37 am
Please log in for more thread options
Visual studio 2005 C# smartphone 2003

I use
DateTime today = DateTime.Now;

to get todays date and time.

I then need to put the date into textbox1 and the time into textbox2.

What is the syntax please.



SteveW



Posted by Peter Foot [MVP] on January 31, 2006, 6:44 am
Please log in for more thread options
The simplest method is today.ToString() but you'll find additional methods
to output specific formats, use the help files/intellisence/object browser
to discover them.

Peter

--
Peter Foot
Windows Embedded MVP
www.peterfoot.net | www.inthehand.com

> Visual studio 2005 C# smartphone 2003
>
> I use
> DateTime today = DateTime.Now;
>
> to get todays date and time.
>
> I then need to put the date into textbox1 and the time into textbox2.
>
> What is the syntax please.
>
>
>
> SteveW
>
>



Posted by Park2 on January 31, 2006, 7:38 am
Please log in for more thread options
Do you have a simple example I cannot find one.




> The simplest method is today.ToString() but you'll find additional methods
> to output specific formats, use the help files/intellisence/object browser
> to discover them.
>
> Peter
>
> --
> Peter Foot
> Windows Embedded MVP
> www.peterfoot.net | www.inthehand.com
>
>> Visual studio 2005 C# smartphone 2003
>>
>> I use
>> DateTime today = DateTime.Now;
>>
>> to get todays date and time.
>>
>> I then need to put the date into textbox1 and the time into textbox2.
>>
>> What is the syntax please.
>>
>>
>>
>> SteveW
>>
>>
>
>



Posted by tamberg on February 1, 2006, 5:31 am
Please log in for more thread options
e.g.

dateTextBox.Text = today.ToShortDateString();
timeTextBox.Text = today.ToShortTimeString();

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatetimememberstopic.asp

alternatively you can use a standard or custom format:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcondatetimeformatstrings.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstandarddatetimeformatstrings.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomdatetimeformatstrings.asp


Posted by MSenne on February 1, 2006, 9:25 am
Please log in for more thread options
In the future you can find help by using the MSDN Library
http://msdn.microsoft.com/library/
Bookmark this, it can be your best friend (web browser
notwithstanding).
Search for "DateTime.ToString" and you'll find exactly what you want to
see.
-MSenne


Similar ThreadsPosted
Contacts modification date October 28, 2005, 3:02 am
Contacts modification date January 24, 2006, 6:40 am
set date and time on Pocket PC February 3, 2006, 3:29 pm
creation date of an SMS with MAPI February 10, 2006, 2:35 pm
POOM Restrict() -- date format changed in WM5? September 16, 2005, 12:40 am
ETEN M600+ Doesn't like programs changing date/time? October 23, 2006, 11:23 am
Any method to get date in Month View of MS Native AP Calendar? January 1, 2008, 9:22 pm
OEM String...? December 11, 2007, 2:13 am
Add String to List box October 4, 2005, 12:30 pm
String in smartphone January 30, 2006, 11:16 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap