开发者

DateFormat problem in pocket pc emulator

开发者 https://www.devze.com 2023-02-28 03:47 出处:网络
While converting a date value in a datatable such as \"4/20/2011 7:10:39 PM\" into a string 开发者_如何学JAVAby using ToString(),it becomes 4/20/11.How can i solve that problem?I want it as 4/20/2011.

While converting a date value in a datatable such as "4/20/2011 7:10:39 PM" into a string 开发者_如何学JAVAby using ToString(),it becomes 4/20/11.How can i solve that problem?I want it as 4/20/2011.I am using Pocket Pc application in .net 2008 and using windows ce 5.0 emulator.


Most actions on DateTime are supported by the .NET Compact Framework:

http://msdn.microsoft.com/en-us/library/system.datetime_members(v=VS.90).aspx

You could use one of the built in ones, or one of the overrides of ToString and specify your own formatting arguments: http://www.dotnetperls.com/datetime-format

The default action of ToString on DateTime takes into account the current culture of the process.

Try:

DateTime.Now.ToString("d/MM/yyyy");

0

精彩评论

暂无评论...
验证码 换一张
取 消