Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
get the chinese year from a given date

        def get_year_from_date(date):
    '''
    get the chinese year from a given date
    '''
    year = 0
    m = re.match("(\d{1,2})\.(\d{1,2})\.(\d{4})", date )
    if m:
        day     = int( m.groups()[0] )
        month   = int( m.groups()[1] )
        year    = int( m.groups()[2] )        
        # new year starts at 4th of february
        if month == 1:
            year = year - 1
        if month == 2 and day < 4:
            year = year - 1
            
        if month == 2 and day == 4 and year in year_starts_at_feb_05:
            year = year -1
    else:
        raise Exception("No valid date passed! %s" % date)
    
    return year
        


src/f/e/fengshui-0.0.3/fengshui.py   fengshui(Download)
        p = self._get_person()
        if p.type == 0:
            year = fengshui_utils.get_year_from_date(p.birthdate)
            facing = float(p.longitude)
            fstars = fengshui_utils.flying_stars(year, facing)