1)如何单独获取系统的年,月,日,时分秒,星期~
2)如何单独获取农历的年,月,日;

解决方案 »

  1.   

    select getdate() 再通过函数来得到你想要的。至于农历那个嘛,你自己再换算一下就OK了
      

  2.   

    系统有函数可以取得的。date, datetime等等,都放在一个单元里面,你自己看delphi的源代码找函数就可以了。时间可以精确到毫秒。
    农历?自己要写对应的转换函数了
      

  3.   

    uses
       DateUtils;
    ------------------------
    YearOf()取得指定日期的年份
    MonthOf()取得指定日期的月份
    DayOf()取得指定日期的天数
    DayOfWeek()取得星期
    .......
      

  4.   

    公历转换为农历:http://www.csdn.com.cn/vzxsxzogoxxzocom/ouovojolxsorou/dfdzdsdsdj/dsdx/smdzdsdsdjdsdxdcdodcdxdzdrdjdudvdjdcdzdo.html
      

  5.   

    用函数decodedate能够单独的获得时、分、秒
      

  6.   

    uses
       DateUtils;
    ------------------------
    YearOf()取得指定日期的年份
    MonthOf()取得指定日期的月份
    DayOf()取得指定日期的天数
    DayOfWeek()取得星期
    .......用这个不行啊~
    报这个错哦~[Error] XXX.pas(106): Incompatible types: 'String' and 'Word'
    怎么办呢~
    Label1.Caption:=YearOf(Date)+'年';
      

  7.   

    import java.util.*;
     import java.text.SimpleDateFormat;
                                                                    
                                                                                       
     public class date                                                                  
     {                                                                                       
        public void getTime()                                               
        {                                                                                    
          Calendar cal = Calendar.getInstance();
          cal.setTime(new Date());
          String year  = String.valueOf(cal.get(Calendar.YEAR)),
              month = String.valueOf(cal.get(Calendar.MONTH)+1), //Calendar.Month 为0,表示一月
        date  = String.valueOf(cal.get(Calendar.DAY_OF_MONTH)),
        week  = String.valueOf(cal.get(Calendar.DAY_OF_WEEK) - 1); //求星期几
          System.out.println(year+'年'+ month + "月" + date + "日  " + "星期" + week);
          
          Date nowTime = new Date();
          SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss G E D F w W a E F");
          System.out.println("现在时间:" + f.format(nowTime));
          
          //求相隔天数
          cal.set(2005,8,2);
          long t1 = cal.getTimeInMillis();
          
          cal.set(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(date)); //today
          long t2 = cal.getTimeInMillis();
          long intervalDates = (t2 -t1)/(1000*60*60*24);
          System.out.println("intervalDays:   " + intervalDates);
          
          //输出当前月的日历页
          System.out.println(" 日  一  二  三  四  五  六");
         cal.set(Integer.parseInt(year),Integer.parseInt(month) - 1 ,1); //today
         //   cal.set(2005,6,1);
         // int y = Integer.parseInt(year);//cal.get(cal.get(Calendar.YEAR));
         // int m = Integer.parseInt(month);//cal.get(Calendar.MONTH)+1;
          //cal.set(y,m,1);
        //  cal.set(y,m-1,1);
          int noweek = cal.get(Calendar.DAY_OF_WEEK) - 1;
          System.out.println("星期"+noweek + "年"+ y +"月"+ m);
          String a[] = new String[noweek + 31];
          for(int i = 0; i < noweek; i++)
          {
           a[i]= "**";
          }
          for(int i = noweek ,n = 1; i<noweek+31; i++){
           if(n<=9)
            a[i] = " " + String.valueOf(n);
           else 
            a[i] = String.valueOf(n);
           n++;
          }
          //输出数组
          for(int i = 0; i<a.length; i++){
           if(i%7 == 0){
            System.out.println("");
           }
           System.out.print(" " + a[i]);
          }
          
        }
                                      
     }
      

  8.   

    Label1.Caption:=inttostr(YearOf(Date))+'年';
      

  9.   

    Format('YYYY', Now) 年
    Format('MM', Now) 月
    Format('DD', Now) 日
    Format('DDD', Now) 星期几
      

  10.   

    sdzeng(大头鸟) 
    谢谢你~行了~
    呵呵~我真的是个菜鸟.这点都没看出来~再次谢谢你`