zoukankan      html  css  js  c++  java
  • C# 中返回星期的函数

    函数如下:

    代入参数年y,月m,日d 即可返回所得的星期
    public static string getWeekDay(int y, int m, int d)
         
    {
                  
    if(m==1) {m=13;y--;}
                    if(m==2) {m=14;y--;}
       
                  
    int week = (d + 2 * m + 3 * (m + 1/ 5 + y + y / 4 - y / 100 + y/400% 7 + 1;
                    
    string strweek="";
                    
    switch (week)
             
    {
                 
    case 1:
                     strweek 
    = "星期一";
                     
    break;
                 
    case 2:
                     strweek 
    = "星期二";
                     
    break;
                 
    case 3:
                     strweek 
    = "星期三";
                     
    break;
                 
    case 4:
                     strweek 
    = "星期四";
                     
    break;
                 
    case 5:
                     strweek 
    = "星期五";
                     
    break;
                 
    case 6:
                     strweek 
    = "星期六";
                     
    break;
                 
    case 7:
                     strweek 
    = "星期日";
                     
    break;
             }

             
    return strweek;
         }
     
  • 相关阅读:
    C#中 @ 的用法
    ASP.NET页面间传值
    ASP.NET中常用的文件上传下载方法
    把图片转换为字符
    把图片转换为字符
    JavaScript 时间延迟
    Using WSDLs in UCM 11g like you did in 10g
    The Definitive Guide to Stellent Content Server Development
    解决RedHat AS5 RPM安装包依赖问题
    在64位Windows 7上安装Oracle UCM 10gR3
  • 原文地址:https://www.cnblogs.com/conquer/p/819026.html
Copyright © 2011-2022 走看看