vb.net中的DateFormat [英] DateFormat in vb.net

查看:277
本文介绍了vb.net中的DateFormat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友,



在我的代码时间日期格式化就像4/24/2013但实际上我需要像2013年4月24日。

请告诉我如何更改此格式。

解决方案

您可以使用格式 [ ^ ]功能。

  Dim  myDate  As  日期 = 日期.Now 
Dim sDate As 字符串 =格式(myDate, MMM dd yyyy
控制台。 WriteLine(sDate)


将自定义格式属性设置为MMM / dd / yyyy

Console.WriteLine(Date.Now.ToString(MMM dd yyyy))


hi Friends,

In my code time date formate is like 4/24/2013 but actually i need like Apr 24 2013 .
Please give me idea how to change this formate.

解决方案

You can use Format[^] function.

Dim myDate As Date = Date.Now
Dim sDate As String = Format(myDate, "MMM dd yyyy")
Console.WriteLine(sDate)


Set the custom format property as MMM/dd/yyyy


Console.WriteLine(Date.Now.ToString("MMM dd yyyy"))


这篇关于vb.net中的DateFormat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆