找到这个月的第一天 [英] Finding the first day of the month

查看:46
本文介绍了找到这个月的第一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在计算该代码的每个月的第一天如下



i am calculating the first day of every month for that code as follows

DateTime now = DateTime.Now;
DateTime firstday = new DateTime(now.Year, now.Month, 1);
string day = firstday.Date.ToString();
Label1.Text = day;





输出如下





Output as follows

7/1/2013 12:00:00 AM







我输出正确,但我希望输出如下






I am getting the output correct, but i want the output as follows

01 Jul 2013





如何使用上面的代码编写代码?





Rgds,

Narasiman P.



How can i write code using my above code?


Rgds,
Narasiman P.

推荐答案

label.Text = firstDay.ToString("dd MMM yyyy");





自定义日期时间格式字符串 [ ^ ]


这篇关于找到这个月的第一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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