equal
deleted
inserted
replaced
544 cnx.create_function("TEXT_LIMIT_SIZE", 2, limit_size2) |
544 cnx.create_function("TEXT_LIMIT_SIZE", 2, limit_size2) |
545 |
545 |
546 def weekday(ustr): |
546 def weekday(ustr): |
547 try: |
547 try: |
548 dt = datetime.strptime(ustr, '%Y-%m-%d %H:%M:%S') |
548 dt = datetime.strptime(ustr, '%Y-%m-%d %H:%M:%S') |
549 except: |
549 except ValueError: |
550 dt = datetime.strptime(ustr, '%Y-%m-%d') |
550 dt = datetime.strptime(ustr, '%Y-%m-%d') |
551 # expect sunday to be 1, saturday 7 while weekday method return 0 for |
551 # expect sunday to be 1, saturday 7 while weekday method return 0 for |
552 # monday |
552 # monday |
553 return (dt.weekday() + 1) % 7 |
553 return (dt.weekday() + 1) % 7 |
554 cnx.create_function("WEEKDAY", 1, weekday) |
554 cnx.create_function("WEEKDAY", 1, weekday) |