c#实现输出本月的月历
效果如图:

代码如下:
namespace WebForm
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
PrintCalender(, );
} public static void PrintCalender(int year, int month)
{
formatDate fd = new formatDate(year, month);
string calender =
@"日 一 二 三 四 五 六
{0} {0} {0} {0} {0} {0} {0}
{0} {0} {0} {0} {0} {0} {0}
{0} {0} {0} {0} {0} {0} {0}
{0} {0} {0} {0} {0} {0} {0}
{0} {0} {0} {0} {0} {0} {0}
{0} {0} {0} {0} {0} {0} {0}";
calender = string.Format(calender, fd).TrimEnd();
HttpContext.Current.Response.Write(calender);
}
} public class formatDate : IFormattable
{
int num;
int max;
public formatDate(int year, int month)
{
DateTime dt = new DateTime(year, month, );
num = (int)dt.DayOfWeek * -;
max = DateTime.DaysInMonth(year, month);
}
public string ToString(string format, IFormatProvider formatProvider)
{
return num++ < || num > max ? " " : num.ToString("");
}
}
}
c#实现输出本月的月历的更多相关文章
- 运维工程师必会的109个Linux命令
运维工程师必会的109个Linux命令 版本1.0 崔存新 更新于2009-12-26 目录 1 文件管理 6 1.1 basename 6 1.2 cat 6 1.3 cd 7 1.4 chgrp ...
- linux 基本命令 [转]
linux 基本命令 1.ls (list 显示当前目录下文件和目录 ls -l 详细显示 =ll ) [root@linux ~]# ls [-aAdfFhilRS] 目录名称 [root@lin ...
- linux指令大全(完整篇)(转)
http://blog.chinaunix.net/uid-9681606-id-1998590.html linux指令大全(完整篇)(转) 2009-03-17 01:21:46 分类: ...
- linux常用命令大全(转)
由于记忆力有限,把平时常用的Linux命令整理出来,以便随时查阅: linux 基本命令 ls (list 显示当前目录下文件和目录 ls -l 详细显示 =ll ) [root@linux ...
- Linux 系统命令及其使用详解(大全)
(来源: 中国系统分析员) cat cd chmod chown cp cut 1.名称:cat 使用权限:所有使用者 使用方式:cat [-AbeEnstTuv] [--help] [--versi ...
- linux常用命令 http://mirrors.163.com/ubuntu-releases/12.04/
由于记忆力有限,把平时常用的Linux命令整理出来,以便随时查阅: linux 基本命令 ls (list 显示当前目录下文件和目录 ls -l 详细显示 =ll ) [root@linux ...
- Linux常用指令大全
2017-03-25 16:35:42 刚开始学习Linux,由于记忆力有限,把平时常用的Linux命令整理出来,以便随时查阅: linux 基本命令 ls (list 显示当前目 ...
- linux终端常用命令
常用的信息显示命令 命令#pwd 用于在屏幕上输出当前的工作目录. 命令#stat 用于显示指定文件的相关信息. 命令#uname -a 用于显示操作系统信息. 命令#hostname 用于显示当前本 ...
- 【Linux】linux命令大全
[注意]:命令[compgen -b]可以列出所有当前系统支持的命令. 109个Linux命令 目录 1 文件管理... 5 1.1 basename. 5 1.2 ...
随机推荐
- laravel5 MAC is invalid
如果本机的环境更换过,项目中用来加密Crypt组件中的参数会变更. 如果出现这个问题,得更换数据库中加密后的变量 stackoverflow上找到的解决方法都是 composer dump-autol ...
- sql第一天
关系数据库中的关系指的就是表 table 表 Column 列 Field 字段 Row 行 非空约束 not null 主键约束(PK)primary key constraint 唯 ...
- centos6 搭建hdwiki
前期准备:安装好Mysql+apache+PHP,测试apache能够解析index.php文件后就可以. 用户名 xiaohe 密码 123456 #### mysql安装好后: adduser w ...
- Java版冒泡排序和选择排序
一.理解说明 1.理解和记忆 冒泡排序:依次定位数组元素,每次只和相邻的且符合条件的元素交换位置. 选择排序:依次在数组的每个位置,通过逐个对比选择出最大或最小的元素. 2.知识点说明 (1)数组是引 ...
- LeetCode #3. Longest Substring Without Repeating Characters C#
Given a string, find the length of the longest substring without repeating characters. Examples: Giv ...
- Codeforces Round #346 (Div. 2) D Bicycle Race
D. Bicycle Race 题目链接http://codeforces.com/contest/659/problem/D Description Maria participates in a ...
- 好用的meta标签
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> 保证中文在网 ...
- echarts样式修改
本人是查看如下链接: http://down.admin5.com/demo/code_pop/cs/dsj/doc/example/themeDesigner.html# 图示很简洁明了.
- C# 委托的三种调用示例(同步调用 异步调用 异步回调)
首先,通过代码定义一个委托和下面三个示例将要调用的方法: 复制代码 代码如下: public delegate int AddHandler(int a,int b); public class ...
- 二十、oracle pl/sql基础
一.pl/sql developer开发工具pl/sql developer是用于开发pl/sql块的集成开发环境(ide),它是一个独立的产品,而不是oracle的一个附带品. 二.pl/sql介绍 ...