is it just for years for B.C.? but currently python's strftime even have error when it's year >= 1900.
On Feb 26, 1:09 pm, mdipierro <[email protected]> wrote: > what about about we do something like this in web2py? > > def format_date(d, format): > format = format.replace('%y',str(d.year)[-2:]) > if d.year>=0: > format = format.replace('%Y',str(d.year)) > else: > format = format.replace('%Y',str(d.year)+'B.C.') > d = > datetime.datetime(2000,d.month,d.day,d.hour,d.minute,d.second) > return d.strftime(format) > > On Feb 25, 10:47 pm, vince <[email protected]> wrote: > > > i run into some rare problem on web2py it's related to python's > > limitation/bugs > > > Traceback (most recent call last): > > File "/Library/WebServer/Documents/web2py/gluon/restricted.py", line > > 173, in restricted > > exec ccode in environment > > File "/Library/WebServer/Documents/web2py/applications/cychurch/ > > controllers/members.py", line 2523, in <module> > > File "/Library/WebServer/Documents/web2py/gluon/globals.py", line > > 96, in <lambda> > > self._caller = lambda f: f() > > File "/Library/WebServer/Documents/web2py/applications/cychurch/ > > controllers/members.py", line 72, in show > > > form1=SQLFORM(db.members,thisrecord,fields=field1,deletable=False,showid=False,labels=header1,submit_button=T('Submit')) > > File "/Library/WebServer/Documents/web2py/gluon/sqlhtml.py", line > > 656, in __init__ > > default = field.formatter(default) > > File "/Library/WebServer/Documents/web2py/gluon/sql.py", line 2676, > > in formatter > > File "/Library/WebServer/Documents/web2py/gluon/validators.py", line > > 2214, in formatter > > return self.other.formatter(value) > > File "/Library/WebServer/Documents/web2py/gluon/validators.py", line > > 1960, in formatter > > return value.strftime(self.format) > > ValueError: year=1897 is before 1900; the datetime strftime() methods > > require year >= 1900 > > > is there any quick workaround for it? any ideas? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

