精华内容
下载资源
问答
  • <p>I have an array of years, months and weeks.... <pre><code>//Returns an array containing the years, months and week numbers between two dates function year_month($start_date, $end_date) ...
  • 今天有一功能点是需要按照日历上面的日期来进行一些数据的计算工作,在计算之前我需要将每一天属于一年52里面的第几周和周几计算出来,在计算之前我还需要有一年内的所有天的日期,整体的思路是十分清晰的,实现...

         今天有一个功能点是需要按照日历上面的日期来进行一些数据的计算工作,在计算之前我需要将每一天属于一年52周里面的第几周和周几计算出来,在计算之前我还需要有一年内的所有天的日期,整体的思路是十分清晰的,实现流程也没有特别复杂的地方,主要就是要细致一点,好了,不多说了,具体实现如下:
     

    #!usr/bin/env python
    # encoding:utf-8
    from __future__ import division
    
    """
    __Author__:沂水寒城
    功能: python生成指定年份所有的天,并计算每天属于一年的第几周和周几
    """
    
    
    import time
    import datetime
    
    month_list = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
    month_day_dict = {
        "01": 31,
        "02": 28,
        "03": 31,
        "04": 30,
        "05": 31,
        "06": 30,
        "07": 31,
        "08": 31,
        "09": 30,
        "10": 31,
        "11": 30,
        "12": 31,
    }
    
    
    def string2Datetime(timestamp, format="%Y-%m-%d %H:%M:%S"):
        """
        把字符串转成datetime
        """
        return datetime.datetime.strptime(timestamp, format)
    
    
    def judgeRunYear(year=2019):
        """
        判断是否是闰年
        """
        if (year % 100 != 0 and year % 4 == 0) or (year % 100 == 0 and year % 400 == 0):
            return True
        else:
            return False
    
    
    def generateMonthDays(month_day_dict, year="2017", month="03"):
        """
        生成指定年份、月份中的所有日期
        """
        day_num = month_day_dict[month]
        day_date_list = []
        for i in range(1, day_num + 1):
            one = str(i)
            if len(one) == 1:
                one = "0" + one
            day_date_list.append(year + "-" + month + "-" + one)
        return day_date_list
    
    
    def genenrateYearDays(year=2019):
        """
        生成一年中所有的日期
        """
        res_list = []
        if judgeRunYear(year=year):
            month_day_dict["02"] = 29
        for one_mon in month_list:
            one_mon_day = generateMonthDays(month_day_dict, year=str(year), month=one_mon)
            res_list += one_mon_day
        return res_list
    
    
    def singleDateHandle(day="2019-07-19", format="%Y-%m-%d"):
        """
        单日处理
        """
        T = string2Datetime(day, format=format)
        weekDay = T.weekday() + 1
        weekNum = T.isocalendar()[1]
        return weekDay, weekNum
    
    
    def genenrateYearDaysWeek(year=2019):
        """
        计算生成一年中每一天属于 第几周  周几
        """
        year_day_list = genenrateYearDays(year=year)
        for one_day in year_day_list:
            weekDay, weekNum = singleDateHandle(day=one_day)
            print("{0} is:  {1}th week, {2}th day.".format(one_day, weekNum, weekDay))
    
    
    if __name__ == "__main__":
        genenrateYearDaysWeek(year=2019)
    

          我们以2019年为例,看一下计算结果,输出如下:
     

    2019-01-01 is:  1th week, 2th day.
    2019-01-02 is:  1th week, 3th day.
    2019-01-03 is:  1th week, 4th day.
    2019-01-04 is:  1th week, 5th day.
    2019-01-05 is:  1th week, 6th day.
    2019-01-06 is:  1th week, 7th day.
    2019-01-07 is:  2th week, 1th day.
    2019-01-08 is:  2th week, 2th day.
    2019-01-09 is:  2th week, 3th day.
    2019-01-10 is:  2th week, 4th day.
    2019-01-11 is:  2th week, 5th day.
    2019-01-12 is:  2th week, 6th day.
    2019-01-13 is:  2th week, 7th day.
    2019-01-14 is:  3th week, 1th day.
    2019-01-15 is:  3th week, 2th day.
    2019-01-16 is:  3th week, 3th day.
    2019-01-17 is:  3th week, 4th day.
    2019-01-18 is:  3th week, 5th day.
    2019-01-19 is:  3th week, 6th day.
    2019-01-20 is:  3th week, 7th day.
    2019-01-21 is:  4th week, 1th day.
    2019-01-22 is:  4th week, 2th day.
    2019-01-23 is:  4th week, 3th day.
    2019-01-24 is:  4th week, 4th day.
    2019-01-25 is:  4th week, 5th day.
    2019-01-26 is:  4th week, 6th day.
    2019-01-27 is:  4th week, 7th day.
    2019-01-28 is:  5th week, 1th day.
    2019-01-29 is:  5th week, 2th day.
    2019-01-30 is:  5th week, 3th day.
    2019-01-31 is:  5th week, 4th day.
    2019-02-01 is:  5th week, 5th day.
    2019-02-02 is:  5th week, 6th day.
    2019-02-03 is:  5th week, 7th day.
    2019-02-04 is:  6th week, 1th day.
    2019-02-05 is:  6th week, 2th day.
    2019-02-06 is:  6th week, 3th day.
    2019-02-07 is:  6th week, 4th day.
    2019-02-08 is:  6th week, 5th day.
    2019-02-09 is:  6th week, 6th day.
    2019-02-10 is:  6th week, 7th day.
    2019-02-11 is:  7th week, 1th day.
    2019-02-12 is:  7th week, 2th day.
    2019-02-13 is:  7th week, 3th day.
    2019-02-14 is:  7th week, 4th day.
    2019-02-15 is:  7th week, 5th day.
    2019-02-16 is:  7th week, 6th day.
    2019-02-17 is:  7th week, 7th day.
    2019-02-18 is:  8th week, 1th day.
    2019-02-19 is:  8th week, 2th day.
    2019-02-20 is:  8th week, 3th day.
    2019-02-21 is:  8th week, 4th day.
    2019-02-22 is:  8th week, 5th day.
    2019-02-23 is:  8th week, 6th day.
    2019-02-24 is:  8th week, 7th day.
    2019-02-25 is:  9th week, 1th day.
    2019-02-26 is:  9th week, 2th day.
    2019-02-27 is:  9th week, 3th day.
    2019-02-28 is:  9th week, 4th day.
    2019-03-01 is:  9th week, 5th day.
    2019-03-02 is:  9th week, 6th day.
    2019-03-03 is:  9th week, 7th day.
    2019-03-04 is:  10th week, 1th day.
    2019-03-05 is:  10th week, 2th day.
    2019-03-06 is:  10th week, 3th day.
    2019-03-07 is:  10th week, 4th day.
    2019-03-08 is:  10th week, 5th day.
    2019-03-09 is:  10th week, 6th day.
    2019-03-10 is:  10th week, 7th day.
    2019-03-11 is:  11th week, 1th day.
    2019-03-12 is:  11th week, 2th day.
    2019-03-13 is:  11th week, 3th day.
    2019-03-14 is:  11th week, 4th day.
    2019-03-15 is:  11th week, 5th day.
    2019-03-16 is:  11th week, 6th day.
    2019-03-17 is:  11th week, 7th day.
    2019-03-18 is:  12th week, 1th day.
    2019-03-19 is:  12th week, 2th day.
    2019-03-20 is:  12th week, 3th day.
    2019-03-21 is:  12th week, 4th day.
    2019-03-22 is:  12th week, 5th day.
    2019-03-23 is:  12th week, 6th day.
    2019-03-24 is:  12th week, 7th day.
    2019-03-25 is:  13th week, 1th day.
    2019-03-26 is:  13th week, 2th day.
    2019-03-27 is:  13th week, 3th day.
    2019-03-28 is:  13th week, 4th day.
    2019-03-29 is:  13th week, 5th day.
    2019-03-30 is:  13th week, 6th day.
    2019-03-31 is:  13th week, 7th day.
    2019-04-01 is:  14th week, 1th day.
    2019-04-02 is:  14th week, 2th day.
    2019-04-03 is:  14th week, 3th day.
    2019-04-04 is:  14th week, 4th day.
    2019-04-05 is:  14th week, 5th day.
    2019-04-06 is:  14th week, 6th day.
    2019-04-07 is:  14th week, 7th day.
    2019-04-08 is:  15th week, 1th day.
    2019-04-09 is:  15th week, 2th day.
    2019-04-10 is:  15th week, 3th day.
    2019-04-11 is:  15th week, 4th day.
    2019-04-12 is:  15th week, 5th day.
    2019-04-13 is:  15th week, 6th day.
    2019-04-14 is:  15th week, 7th day.
    2019-04-15 is:  16th week, 1th day.
    2019-04-16 is:  16th week, 2th day.
    2019-04-17 is:  16th week, 3th day.
    2019-04-18 is:  16th week, 4th day.
    2019-04-19 is:  16th week, 5th day.
    2019-04-20 is:  16th week, 6th day.
    2019-04-21 is:  16th week, 7th day.
    2019-04-22 is:  17th week, 1th day.
    2019-04-23 is:  17th week, 2th day.
    2019-04-24 is:  17th week, 3th day.
    2019-04-25 is:  17th week, 4th day.
    2019-04-26 is:  17th week, 5th day.
    2019-04-27 is:  17th week, 6th day.
    2019-04-28 is:  17th week, 7th day.
    2019-04-29 is:  18th week, 1th day.
    2019-04-30 is:  18th week, 2th day.
    2019-05-01 is:  18th week, 3th day.
    2019-05-02 is:  18th week, 4th day.
    2019-05-03 is:  18th week, 5th day.
    2019-05-04 is:  18th week, 6th day.
    2019-05-05 is:  18th week, 7th day.
    2019-05-06 is:  19th week, 1th day.
    2019-05-07 is:  19th week, 2th day.
    2019-05-08 is:  19th week, 3th day.
    2019-05-09 is:  19th week, 4th day.
    2019-05-10 is:  19th week, 5th day.
    2019-05-11 is:  19th week, 6th day.
    2019-05-12 is:  19th week, 7th day.
    2019-05-13 is:  20th week, 1th day.
    2019-05-14 is:  20th week, 2th day.
    2019-05-15 is:  20th week, 3th day.
    2019-05-16 is:  20th week, 4th day.
    2019-05-17 is:  20th week, 5th day.
    2019-05-18 is:  20th week, 6th day.
    2019-05-19 is:  20th week, 7th day.
    2019-05-20 is:  21th week, 1th day.
    2019-05-21 is:  21th week, 2th day.
    2019-05-22 is:  21th week, 3th day.
    2019-05-23 is:  21th week, 4th day.
    2019-05-24 is:  21th week, 5th day.
    2019-05-25 is:  21th week, 6th day.
    2019-05-26 is:  21th week, 7th day.
    2019-05-27 is:  22th week, 1th day.
    2019-05-28 is:  22th week, 2th day.
    2019-05-29 is:  22th week, 3th day.
    2019-05-30 is:  22th week, 4th day.
    2019-05-31 is:  22th week, 5th day.
    2019-06-01 is:  22th week, 6th day.
    2019-06-02 is:  22th week, 7th day.
    2019-06-03 is:  23th week, 1th day.
    2019-06-04 is:  23th week, 2th day.
    2019-06-05 is:  23th week, 3th day.
    2019-06-06 is:  23th week, 4th day.
    2019-06-07 is:  23th week, 5th day.
    2019-06-08 is:  23th week, 6th day.
    2019-06-09 is:  23th week, 7th day.
    2019-06-10 is:  24th week, 1th day.
    2019-06-11 is:  24th week, 2th day.
    2019-06-12 is:  24th week, 3th day.
    2019-06-13 is:  24th week, 4th day.
    2019-06-14 is:  24th week, 5th day.
    2019-06-15 is:  24th week, 6th day.
    2019-06-16 is:  24th week, 7th day.
    2019-06-17 is:  25th week, 1th day.
    2019-06-18 is:  25th week, 2th day.
    2019-06-19 is:  25th week, 3th day.
    2019-06-20 is:  25th week, 4th day.
    2019-06-21 is:  25th week, 5th day.
    2019-06-22 is:  25th week, 6th day.
    2019-06-23 is:  25th week, 7th day.
    2019-06-24 is:  26th week, 1th day.
    2019-06-25 is:  26th week, 2th day.
    2019-06-26 is:  26th week, 3th day.
    2019-06-27 is:  26th week, 4th day.
    2019-06-28 is:  26th week, 5th day.
    2019-06-29 is:  26th week, 6th day.
    2019-06-30 is:  26th week, 7th day.
    2019-07-01 is:  27th week, 1th day.
    2019-07-02 is:  27th week, 2th day.
    2019-07-03 is:  27th week, 3th day.
    2019-07-04 is:  27th week, 4th day.
    2019-07-05 is:  27th week, 5th day.
    2019-07-06 is:  27th week, 6th day.
    2019-07-07 is:  27th week, 7th day.
    2019-07-08 is:  28th week, 1th day.
    2019-07-09 is:  28th week, 2th day.
    2019-07-10 is:  28th week, 3th day.
    2019-07-11 is:  28th week, 4th day.
    2019-07-12 is:  28th week, 5th day.
    2019-07-13 is:  28th week, 6th day.
    2019-07-14 is:  28th week, 7th day.
    2019-07-15 is:  29th week, 1th day.
    2019-07-16 is:  29th week, 2th day.
    2019-07-17 is:  29th week, 3th day.
    2019-07-18 is:  29th week, 4th day.
    2019-07-19 is:  29th week, 5th day.
    2019-07-20 is:  29th week, 6th day.
    2019-07-21 is:  29th week, 7th day.
    2019-07-22 is:  30th week, 1th day.
    2019-07-23 is:  30th week, 2th day.
    2019-07-24 is:  30th week, 3th day.
    2019-07-25 is:  30th week, 4th day.
    2019-07-26 is:  30th week, 5th day.
    2019-07-27 is:  30th week, 6th day.
    2019-07-28 is:  30th week, 7th day.
    2019-07-29 is:  31th week, 1th day.
    2019-07-30 is:  31th week, 2th day.
    2019-07-31 is:  31th week, 3th day.
    2019-08-01 is:  31th week, 4th day.
    2019-08-02 is:  31th week, 5th day.
    2019-08-03 is:  31th week, 6th day.
    2019-08-04 is:  31th week, 7th day.
    2019-08-05 is:  32th week, 1th day.
    2019-08-06 is:  32th week, 2th day.
    2019-08-07 is:  32th week, 3th day.
    2019-08-08 is:  32th week, 4th day.
    2019-08-09 is:  32th week, 5th day.
    2019-08-10 is:  32th week, 6th day.
    2019-08-11 is:  32th week, 7th day.
    2019-08-12 is:  33th week, 1th day.
    2019-08-13 is:  33th week, 2th day.
    2019-08-14 is:  33th week, 3th day.
    2019-08-15 is:  33th week, 4th day.
    2019-08-16 is:  33th week, 5th day.
    2019-08-17 is:  33th week, 6th day.
    2019-08-18 is:  33th week, 7th day.
    2019-08-19 is:  34th week, 1th day.
    2019-08-20 is:  34th week, 2th day.
    2019-08-21 is:  34th week, 3th day.
    2019-08-22 is:  34th week, 4th day.
    2019-08-23 is:  34th week, 5th day.
    2019-08-24 is:  34th week, 6th day.
    2019-08-25 is:  34th week, 7th day.
    2019-08-26 is:  35th week, 1th day.
    2019-08-27 is:  35th week, 2th day.
    2019-08-28 is:  35th week, 3th day.
    2019-08-29 is:  35th week, 4th day.
    2019-08-30 is:  35th week, 5th day.
    2019-08-31 is:  35th week, 6th day.
    2019-09-01 is:  35th week, 7th day.
    2019-09-02 is:  36th week, 1th day.
    2019-09-03 is:  36th week, 2th day.
    2019-09-04 is:  36th week, 3th day.
    2019-09-05 is:  36th week, 4th day.
    2019-09-06 is:  36th week, 5th day.
    2019-09-07 is:  36th week, 6th day.
    2019-09-08 is:  36th week, 7th day.
    2019-09-09 is:  37th week, 1th day.
    2019-09-10 is:  37th week, 2th day.
    2019-09-11 is:  37th week, 3th day.
    2019-09-12 is:  37th week, 4th day.
    2019-09-13 is:  37th week, 5th day.
    2019-09-14 is:  37th week, 6th day.
    2019-09-15 is:  37th week, 7th day.
    2019-09-16 is:  38th week, 1th day.
    2019-09-17 is:  38th week, 2th day.
    2019-09-18 is:  38th week, 3th day.
    2019-09-19 is:  38th week, 4th day.
    2019-09-20 is:  38th week, 5th day.
    2019-09-21 is:  38th week, 6th day.
    2019-09-22 is:  38th week, 7th day.
    2019-09-23 is:  39th week, 1th day.
    2019-09-24 is:  39th week, 2th day.
    2019-09-25 is:  39th week, 3th day.
    2019-09-26 is:  39th week, 4th day.
    2019-09-27 is:  39th week, 5th day.
    2019-09-28 is:  39th week, 6th day.
    2019-09-29 is:  39th week, 7th day.
    2019-09-30 is:  40th week, 1th day.
    2019-10-01 is:  40th week, 2th day.
    2019-10-02 is:  40th week, 3th day.
    2019-10-03 is:  40th week, 4th day.
    2019-10-04 is:  40th week, 5th day.
    2019-10-05 is:  40th week, 6th day.
    2019-10-06 is:  40th week, 7th day.
    2019-10-07 is:  41th week, 1th day.
    2019-10-08 is:  41th week, 2th day.
    2019-10-09 is:  41th week, 3th day.
    2019-10-10 is:  41th week, 4th day.
    2019-10-11 is:  41th week, 5th day.
    2019-10-12 is:  41th week, 6th day.
    2019-10-13 is:  41th week, 7th day.
    2019-10-14 is:  42th week, 1th day.
    2019-10-15 is:  42th week, 2th day.
    2019-10-16 is:  42th week, 3th day.
    2019-10-17 is:  42th week, 4th day.
    2019-10-18 is:  42th week, 5th day.
    2019-10-19 is:  42th week, 6th day.
    2019-10-20 is:  42th week, 7th day.
    2019-10-21 is:  43th week, 1th day.
    2019-10-22 is:  43th week, 2th day.
    2019-10-23 is:  43th week, 3th day.
    2019-10-24 is:  43th week, 4th day.
    2019-10-25 is:  43th week, 5th day.
    2019-10-26 is:  43th week, 6th day.
    2019-10-27 is:  43th week, 7th day.
    2019-10-28 is:  44th week, 1th day.
    2019-10-29 is:  44th week, 2th day.
    2019-10-30 is:  44th week, 3th day.
    2019-10-31 is:  44th week, 4th day.
    2019-11-01 is:  44th week, 5th day.
    2019-11-02 is:  44th week, 6th day.
    2019-11-03 is:  44th week, 7th day.
    2019-11-04 is:  45th week, 1th day.
    2019-11-05 is:  45th week, 2th day.
    2019-11-06 is:  45th week, 3th day.
    2019-11-07 is:  45th week, 4th day.
    2019-11-08 is:  45th week, 5th day.
    2019-11-09 is:  45th week, 6th day.
    2019-11-10 is:  45th week, 7th day.
    2019-11-11 is:  46th week, 1th day.
    2019-11-12 is:  46th week, 2th day.
    2019-11-13 is:  46th week, 3th day.
    2019-11-14 is:  46th week, 4th day.
    2019-11-15 is:  46th week, 5th day.
    2019-11-16 is:  46th week, 6th day.
    2019-11-17 is:  46th week, 7th day.
    2019-11-18 is:  47th week, 1th day.
    2019-11-19 is:  47th week, 2th day.
    2019-11-20 is:  47th week, 3th day.
    2019-11-21 is:  47th week, 4th day.
    2019-11-22 is:  47th week, 5th day.
    2019-11-23 is:  47th week, 6th day.
    2019-11-24 is:  47th week, 7th day.
    2019-11-25 is:  48th week, 1th day.
    2019-11-26 is:  48th week, 2th day.
    2019-11-27 is:  48th week, 3th day.
    2019-11-28 is:  48th week, 4th day.
    2019-11-29 is:  48th week, 5th day.
    2019-11-30 is:  48th week, 6th day.
    2019-12-01 is:  48th week, 7th day.
    2019-12-02 is:  49th week, 1th day.
    2019-12-03 is:  49th week, 2th day.
    2019-12-04 is:  49th week, 3th day.
    2019-12-05 is:  49th week, 4th day.
    2019-12-06 is:  49th week, 5th day.
    2019-12-07 is:  49th week, 6th day.
    2019-12-08 is:  49th week, 7th day.
    2019-12-09 is:  50th week, 1th day.
    2019-12-10 is:  50th week, 2th day.
    2019-12-11 is:  50th week, 3th day.
    2019-12-12 is:  50th week, 4th day.
    2019-12-13 is:  50th week, 5th day.
    2019-12-14 is:  50th week, 6th day.
    2019-12-15 is:  50th week, 7th day.
    2019-12-16 is:  51th week, 1th day.
    2019-12-17 is:  51th week, 2th day.
    2019-12-18 is:  51th week, 3th day.
    2019-12-19 is:  51th week, 4th day.
    2019-12-20 is:  51th week, 5th day.
    2019-12-21 is:  51th week, 6th day.
    2019-12-22 is:  51th week, 7th day.
    2019-12-23 is:  52th week, 1th day.
    2019-12-24 is:  52th week, 2th day.
    2019-12-25 is:  52th week, 3th day.
    2019-12-26 is:  52th week, 4th day.
    2019-12-27 is:  52th week, 5th day.
    2019-12-28 is:  52th week, 6th day.
    2019-12-29 is:  52th week, 7th day.
    2019-12-30 is:  1th week, 1th day.
    2019-12-31 is:  1th week, 2th day.

            出来了结果怎么核实呢?我们直接看今天的日期就好了,如下所示:

          我们分别截取了系统时间和程序输出时间,可以看到周几这个结果是正确的,至于第几周感兴趣的话可以对照系统时间数一数就好了,我验证过了是没有问题。 

    展开全文
  • 最近用domino做了一周工作日志安排的项目,需要用户在表上填写每天的工作日志,不想把表中的日期写死,所以用函数把一的开始/结束日期算出来,下面是程序代码:以下为转载,来源至百度搜索说明一下,我这里是...

    最近用domino做了一个一周工作日志安排的项目,需要用户在表上填写每天的工作日志,不想把表中的日期写死,所以用函数把一周的开始/结束日期算出来,下面是程序代码:

     

    以下为转载,来源至百度搜索

     

    说明一下,我这里是以星期日作为一周的开始

    思路如下:
    首先要计算今天离元旦相差多少天,然后除以7就得出今天离元旦多少个星期了。
    这里要判断有无余数,如果有余数,则把商加1,就得出今天相距元旦多少个星期了。

    程序代码程序代码

    REM {获取元旦};
    yuandan := @ToTime(@Text(@Year(@Now))+"-01-01");
    x:= @Integer(((@Today-yuandan)/(3600*24)+1)/7);
    y:=((@Today-yuandan)/(3600*24)+1)/7;
    @If(y-x>0;x+1;x)



    但目前算出的只是今天相距元旦的星期数,并不是真正的周次。

    因为每年元旦并不都是星期日,例如2006年的元旦是星期日,则本年的第一周是完整的一周(有7天)。
    如果元旦不是星期日,则本年的第一周就只有(7-星期数)天。
    例如2005年的元旦是星期六,则本年的第一周只有1天,1月2号就是第二周的开始了。

    所以如果只用上面的四行代码,是不符合实际情况的。
    而且上面的代码还有bug,如果@Today是元旦,那会输出0。

    要计算真正的周次,就要从第二周开始算起。
    第一周的天数是7减元旦的星期数,
    如果元旦是星期日, @Weekday(yuandan)返回1,星期一返回2。
    所以星期数要减一。代码如下:

    程序代码程序代码

    yuandan := @ToTime(@Text(@Year(@Now))+"-01-01");
    wd := @Weekday(yuandan);
    t := 7-(wd-1);



    用@Today 减元旦,再减第一周天数t,再加一,就是@Today到第二周开始的天数t1。
    这里要做个判断,
    If @Today 就是第一周里的,那得出的结果t1就会是负数,我们可以直接输出@Today 所在周次是第一周。
    Else  用 t1除以7,得出@Today 距离第二周有多少周。 然后加上1,就是加上第一周。就得出实际的周次了。

    这里还有个需求就是,一年365天,就等于52周加1天。每年的第53周与下一年的第一周其实是同一周,
    所以这里的周报只算52周,如果算到第53周,就改为下一年的第一周。
    具体实现就是把53改为1,然后把年份那个域的值加1。

    程序代码程序代码
    @If(z=53;z:=1;z);



    完整代码如下:

    程序代码程序代码

    REM {获取元旦};
    yuandan := @ToTime(@Text(@Year(@Now))+"-01-01");
    REM {判断元旦是否sunday,@Weekday(sunday)=1};
    wd := @Weekday(yuandan);
    @If(wd=1;
    @Do(
    x:= @Integer(((@Today-yuandan)/(3600*24)+1)/7);
    y:=((@Today-yuandan)/(3600*24)+1)/7;
    @If(y-x>0;x+1;x)
    );
    @Do(
    t := 7-(wd-1);
    t1 := (@Today-yuandan)/(3600*24)-t+1;
    @If(t1>0;
    @Do(
    x:=@Integer(t1/7);
    y:=t1/7;
    @If(y-x>0;z:=x+2;z:=x+1);
    @If(z=53;z:=1;z);
    z
    );
    @Do(
    1
    ))
    )
    )
     
     
    以下为原创
    1.计算当天所在周从周一到周日的天数
    weekstart:=@Adjust(@Today;0;0;-(@Weekday(@Today)-2);0;0;0);
    weekend:=@Adjust(weekstart;0;0;6;0;0;0);
    Text(weekstart)+"至"+@Text(weekend)
    2.计算当天所在周每一天的日期
    星期一:
    weekstart:=@Adjust(@Today;0;0;-(@Weekday(@Today)-2);0;0;0);
    @Text(weekstart;"D2")
    星期二:
    weekstart:=@Adjust(@Today;0;0;-(@Weekday(@Today)-2);0;0;0);
    week:=@Adjust(weekstart;0;0;1;0;0;0);
    @Text(week;"D2")
    星期三:
    weekstart:=@Adjust(@Today;0;0;-(@Weekday(@Today)-2);0;0;0);
    week:=@Adjust(weekstart;0;0;2;0;0;0);
    @Text(week;"D2")
    星期四:
    weekstart:=@Adjust(@Today;0;0;-(@Weekday(@Today)-2);0;0;0);
    week:=@Adjust(weekstart;0;0;3;0;0;0);
    @Text(week;"D2")
    星期五:
    weekstart:=@Adjust(@Today;0;0;-(@Weekday(@Today)-2);0;0;0);
    week:=@Adjust(weekstart;0;0;4;0;0;0);
    @Text(week;"D2")
    星期六:
    weekstart:=@Adjust(@Today;0;0;-(@Weekday(@Today)-2);0;0;0);
    week:=@Adjust(weekstart;0;0;5;0;0;0);
    @Text(week;"D2")
    星期天:
    weekstart:=@Adjust(@Today;0;0;-(@Weekday(@Today)-2);0;0;0);
    week:=@Adjust(weekstart;0;0;6;0;0;0);
    @Text(week;"D2")

    3.计算任意一周的周一至周日
    很简单,假设当周为CurrentWeekNo; 任意一周为:WeekNo;要计算任意一周的周一至周日公式就是:
    tmp:=CurrentWeekNo-WeekNo;
    step:=2-tmp*7;
    rem {任意一周的周一,得到周一,那二/三/四...就很轻松得到};
    weekstart:=@Adjust(@Today;0;0;-(@Weekday(@Today)-step);0;0;0);
    ---------------------------------------------------------------
    下面就是最近做的一个日志模块的图,图中所有的日期都是通过上面的算法算出来的,还不错吧
    展开全文
  • 一年总结

    2015-04-07 16:28:49
    现在的工作一年几个周,在此记录下自己这一年的变化吧。 站在我自己的角度,其实这一年成长不大,只学会了基本的linux操作命令,学会了安装系统,学会了写简单的小脚本,其他的就没什么了。想想一年其实是可以...

    这是继找工作之后,第三次更新博客。现在的工作了一年零几个周,在此记录下自己这一年的变化吧。

    站在我自己的角度,其实这一年成长不大,只学会了基本的linux操作命令,学会了安装系统,学会了写简单的小脚本,其他的就没什么了。想想一年其实是可以学习很多新知识的,我是对自己的要求太简单,所以才会没有多大的成长吧。一度想学习写代码,是因为代码会很大的提升工作效率和工作质量。但是感觉到自己写代码的能力特差,加之杂事比较多,自己的时间利用率比较低,所以没有去实施。 先写到这里吧,回头有空再写。

    展开全文
  • 工作一年后的感想

    千次阅读 2013-10-20 01:02:24
    工作一年后的感想  今天出去找同学玩了,几个月没见了,在一起聚聚,闲聊胡侃半天,玩的还挺嗨嘛!...说点背景吧,出差回京一了,周四晚上下班也去找了几个关系不错的同学,聊聊天叙叙旧。(为什么是周四晚上

    工作一年后的感想

        今天出去找同学玩了,几个月没见了,在一起聚聚,闲聊胡侃半天,玩的还挺嗨嘛!当然这都是结果了。

        大家也都知道,北京太大了,虽然说大家都在北京生活工作等等,可是真要出去找个同学还是有点难度的,出去一趟来回怎么也有大半天的,所以我有充足的时间去思考人生(说的大了点偷笑)。说点背景吧,出差回京一周了,周四晚上下班也去找了几个关系不错的同学,聊聊天叙叙旧。(为什么是周四晚上呢?也是思考后才决定要周四去的,首先,大周末的想好好休息休息,不想往外跑了,很累的;其次,感觉在北京上班的人流的多少每天还是有点不同的,比如周一明显人很多,在地铁排队就能见分晓了,感觉周三周四人就没那么多了,我一直很纳闷为什么会这样呢,因为周一是一周的开始,所以大家都很积极吗?也不见得,或许有些人是周三周四休息呢也说不准啊,所以也不去管他,和我没关系啦,除了上班稍微不那么挤。)周四那天晚上大家相聚的收获是什么呢?这也就是我今天想说一下的。

        其中一位同学刚换了工作,自然也说了一些和跳槽相关的事情,他们都觉得工作有一年多了,再换工作的话去面试明显比较有底气了(技术见长嘛,而且是有了工作经验就不一样了,你们公司不就是想要有工作经验的吗?我有啊!);再者就是面试没有以前那么青涩吧,回想刚开始找工作的时候,去面试都小心翼翼的(我觉得我是,大家比较牛的当然不会像我这么没出息了!);然后就是不再那么着急吧,刚毕业就像快点找到一份工作,特别是当你的同学都找到工作后你就更紧张了,就开始胡思乱想,我是不是怎样怎样。。。如果现在跳槽应该不会出现那种情况了,你会仔细去斟酌,去想哪家公司更适合你,哪家公司给你提供的工作岗位是你想要的,甚至薪资等等。

        当然了,说说自己的一些情况,作为半瓶醋的我现在咣当成什么样了呢?首先得说说自己的同事,大家都说只要跳槽的话薪资很容易就能翻番,当然我知道这并不是信口开河,活生生的例子很多很多,可是一结合自身,我就不明白他们是怎么翻番的,是自己太弱了吗?还是他们太强了?自己怎么也算不上什么牛X人物吧,其实和刚毕业的时候有什么区别呢?只是多了个工作经验而已!如果我跳槽真的敢去要那个翻番后的工资吗?说实话真没那个底气,工作一年半有余了,从来没写过代码,有时候我真怀疑我是浑浑噩噩的得过且过度过这一年半载的。每次面对一个新项目,自己免不了的紧张,完全没有接触过,还得学习全新的东西,感觉上一个还没完全搞明白就要再搞一个全新的东西,这对自己的发展有益吗?不知道!好吧,还不得不说的是自己和客户的交流上的问题很大,表达能力也需要进一步提高,有问题也不知道积极去问,这样对自己的成长也很不利吧!当然这和自己的心态也有很大的关系。真的又说多了吧,每次都在分析自己存在的问题,但是就是改不了,下次分析还是存在,并且可能还会产生新的问题,这可如何是好呢?有时候感觉自己缺乏激励自己的东西,就像有人为了某个人某件事去奋斗一样,我不会真的那么欠吧!

        前两天大学老师在群里发消息说现在的学弟学妹们已经开始找工作了,想想时间过的好快了,自己走出校门说起来快两年了,曾经让我鄙夷过别人口中的大学生活转眼即逝,现在回想一下真的是转眼即逝啊,只能感叹造化弄人了!真像有句话说的,年轻时你对着镜子扮着鬼脸,等老了镜子就对着你扮着鬼脸。只能说一个字:唉!

        好吧,不想再感叹什么了,还是想勉励一下自己,这次回京也不是那么轻松的,看来领导还是器重咱的,给分配了一个重要的项目,说是能学到很多东西的,这当然也是我想要做的,可是做了一周了,每天只是叹气,只是纠结啊!看别人写的代码,硕大的系统,每天都很纠结啊,文档一大堆,也看了一大堆了,真是“剪不断,理还乱”了,越看越乱了,看到最后领导都有点失去耐心了,就这样把自己给葬送了吗?对了,今天给刚找到工作的那同学打电话,他竟然告诉我在公司上班,我说你也太没气节了,刚进公司就加班,到最后还指不定被折磨成什么样子呢!后来见面了他说现在公司项目正忙呢,而且他想尽快熟悉公司的那些系统架构、功能。他还说如果明天没事还想去公司。。。后来我想还是他说的对,对于我们这些还处于菜鸟级别的人来说,能多学点就学吧!所以我也要更加努力了,好好的理理系统,下周开会也好能提出点问题来啊。。。

        好吧,努力吧,别整天没事就想着看个电影吧,看那些无聊的笑话。。。专注一些,提高自己,好好奋斗!奋斗


        ps:最后让我惊讶的是蛋蛋同学竟然要订婚了,明年就要结婚了,几个月没见我都被这突如其来的改变震惊了,顺祝蛋蛋同学幸福哇!还有要注意身体,不然就没有本钱奋斗啦!加油蛋蛋同学!

    展开全文
  • 北飘实习一年的总结

    千次阅读 2020-06-25 17:12:31
    时间过的好快啊,转眼间一年过去了,这一年来自我感觉不容易的,但也取得了不错的成绩,记得去年7月份,自己当时怀着梦想来到北京,前几个月跟我侄子合租在回龙观,开始了找工作,在来北京前半个月,我就在网上投了...
  • 现在突然觉得,自己在迷惘,时间一过去,这一末玩的很high,熬上5天,盼着下一周末,又玩一下。生活像流水帐,纵使玩得再高兴,但却觉得自己越来越麻木... 大学在广东一所一本学校读计算机,四年下来...
  • 毕业一年小结——说好的战斗呢?

    千次阅读 多人点赞 2015-12-31 10:22:53
    本片文章写与2015年9月份。之前是发布在了自己 github 上的 blog项目中。趁着写年终总结的机会迁移到自己的个人博客。...之后就是在团队里面因为一紧急的项目,忙忙碌碌了好几周,记得这过程中
  • 一年没回来了

    2019-10-04 23:59:22
    翻看了一下过去的文章,都是去年大三的时候,最后为了实习找工作,强行看了几个视频,然后总结的结论,哈哈,还是挺不错的。 最后也找个一份不错的工作,虽然干了3个月,因为自己的偷懒,辞职了。是有点小后悔,...
  • 一年的学习计划

    2012-08-16 11:42:16
    自己不能永远在小公司混迹,心目中的那家公司一定去尝试的,所以得给自己定一个一年的学习计划,明年的八月咱们再见分晓: 1、汇编语言 至少能看懂、能进行汇编语言级别的调试(两到三) 2、算法 算
  • 2018年总结:他的一年

    热门讨论 2019-01-29 20:51:04
    2018年--寒假结束,作品展即将开始,也许是机缘巧合,他是当月的负责人,因此自告奋勇当上了作品展临时负责人,负责了天的人员组织,而同时服务器部门的交接工作也悄然而至,他又扛下了两头重担,圆了自己不到十天...
  • 因为项目中需要一个每周工作计算的功能,具体日期的算法是,把每月拆分成几个周,最后一个星期这个月份的天数不够就补上下个月的。 列如今天8月27星期一,这个月有31天,但是这个星期最后的一天是9月1号,所以要把9...
  • 乘高铁来天津,早在前天看了房子,直接联系的房东,两室一厅整租1500/月,上午九点半到了天津西站后倒地铁坐公交,11点多才到自己要租的房子这,联系房东看房,房子我很满意,就是有一点,至少租一年,半年付一次...
  • 一个java程序员4年4个工作的经历

    万次阅读 热门讨论 2014-02-21 18:28:16
    今天看到一帖子说程序员怎么提升自己的技能,里面说了十多项,对自己感觉能有用的有以下点:读书、读代码、读博客、写博客,回答别人的问题,参加一开源项目,...一天、一、一月、一年只要有提高就是进步,多学
  • 一年的第一周几点? 如果是前一年呢? 特征 防止合并(如果已存在)。 节省处理时间 使文件夹遍历递归 仅合并“ .wav”文件,而不是所有文件 使格式更灵活。 更改子字符串编号并设置“字符串”格式
  • 汇报--生活分享

    2020-07-09 22:12:30
    不知不觉已经过去一年了,受疫情的影响,我们这届的师兄师姐实际上只在学校完成了半学期的学习,还有一半的时间在家中自学,这过程可谓是艰难。最近,又到了一年一轮的研究生招生时间,我们实验室也迎来了许多新生...
  • 可能你是高年级博士生,有几个硕士生围绕着你做项目;也可能你正在创业,需要组建一个小型技术团队来帮助你完成梦想。我们都能感到自己肩上的责任,领导的信任;但是团队管理这个事情好像并没有什么好说的:你拿到...
  • 今天是2017年10月30号周一,十一中秋假期8天,5号结婚,遂请婚假三天,事假2天,就意味着我是16号开始上班的,其实这一个月也就上了半个月的班,但感觉假期、结婚已经是几个世纪的事情了,细细想来,慨叹时光匆匆。...
  • 第十四总结

    2021-06-06 10:29:50
    学习上:    项目再赶快一点,就该进入收尾阶段了。...   时间还是过的飞快,下周就要考四级了,就才做了篇题,感觉不是很有信心,碰碰运气吧,明天考试就是新一年的高考季了,祝愿他们顺其自然、。 ...
  • 近况寥寥

    2021-03-16 00:12:51
    从去年7月踏入社会后,有8月左右没有记录点什么了。上次写东西还是去年4月写毕业论文的时候。记得当时愁着写毕业论文,焦头又烂额头。一居然瘦了5斤(我这种高中三年可以胖30多斤的,居然写论文瘦了。。。)转眼...
  • ​2017-10-16 11次课

    2017-10-17 03:27:54
    2017-10-16 11次课1.1 学习之初1.2 约定1.3 认识Linux1.4 安装虚拟机1.5 安装centos7已经完成笔记如下:一开始,阿铭老师给大家提出了几个问题给大家思考:学这个课程的目的是什么?学完之后要做的职位是什么?学...
  • 学ML一以来的随想

    2018-09-29 21:39:39
    我的专业是正经工科,能做流体仿真,流体仿真,还有…流体仿真,这是入学一年来一直在搞的东西,风机设计了几个,难出文章,重复性工作更是让我感到厌烦。不知道哪天开始,想学一学机器学习,想搞数据挖掘。从知乎到...
  • 关于工作

    2012-02-23 09:58:04
    2011,注定是比较折腾...然后在见面,离开中重复了几个月,在纠结什么时候提离职中又度过了相当长的时间,8月,工作4年来,休息最长的一个假期,3。10月底,离职 11月中,去了一个创业型小公司,因不适应管理方式及
  • 为了简化这个问题,须要以下几个如果。 1. 不考虑日,将其视作普通工作日 2. 假日没有交叠情况。不会出现10月1日到7日是国庆节,当中又有一个其他的节日 给出假日表的设计,某个假日都有起始时间和结束时间...
  • 我在最后两个学期申请了大约60-80个工作,并在2019年5月毕业前几周被录用。 作为工作的一部分,我有机会在波士顿大学和哈佛大学的多个招聘会上代表我的公司,然后积极参与接下来年新员工的甄选。 这是一次令人...
  • 工作 Day22 周四

    2016-01-28 22:26:00
    都很忙,一转眼就剩周五了。周六下午开年会,原公司工资还没给,今天又问了一次,还是说这天会结清。。。去年(现在叫前年了)那公司年终就只发了百块。。。说希望下一年公司能发展的好,到时再发,今年就混...
  • 离职的半

    2020-11-22 20:29:12
    此刻我已是自由之身,在这公司工作一年,一直都是没有时间好好做点自己想做的事情(出去旅游一趟)嘻嘻!第一我没有忙着找工作也没有修改简历,什么都没做,就想安安静静的一人四处走走看看。 浪完一我就...
  • 天在赶项目,一人单双的版本迭代,表示压力很大。其实这对于刚刚工作不到一年的小菜来说,是极大的锻炼机会。正应了那句话痛并快乐着的话,其实我是痛并成长着。 这天修改之前写的接口,其实间隔时间并不...
  • 我的2014

    2014-12-27 22:17:18
    转眼间两孩子都已经一零四月了,想想去年的这时候孩子们还都在襁褓之中。回想过去的2014,主要做了以下件事: 第0件:买了房子,成了名副其实的房奴。 第1件:为了生活换了一份工作。 第2件:第一次基本独立...

空空如也

空空如也

1 2 3 4 5 ... 7
收藏数 128
精华内容 51
关键字:

一年几个工作周