On Tuesday, August 9, 2016 at 12:24:11 PM UTC-7, madhu nomula wrote: > > Actually my requirement is to compare this result with a value from a > dropdown selected item. > Could you please suggest me the best option to capture from view to > get date instead on decimal forrmat. >
So you're just using the printing example to debug your variable handling, right? > > On Wed, Aug 10, 2016 at 12:28 AM, Niphlod <[email protected] <javascript:>> > wrote: > > the problem is not the resultset: it's how it's injected into the > view!!!! > Okay. (I thought maybe the OP, madhu, was using a DB with a funky date format, like a string) In one of my functions, the controller returns a date time as part of the results dictionary, and I have a script that does var date2try1 = "{{=results[datefield]}}"; which gives me a string, and then I do a new Date(date2try1) to allow me to print it in UTC ( toUTCString() ). The database I was using in that project was Sqlite3. (In another page of the project, I just pass results rows to SQLTABLE) Is any of this helpful here? /dps > > > > > On Tuesday, August 9, 2016 at 8:28:23 PM UTC+2, Dave S wrote: > >> > >> > >> > >> On Tuesday, August 9, 2016 at 10:56:48 AM UTC-7, madhu nomula wrote: > >>> > >>> db.define_table('ActivityMapping', > >>> Field('mapping_id'), > >>> Field('resource_id',db.auth_user), > >>> Field('org_id',db.Organization), > >>> Field('solution_id',db.Solution), > >>> Field('activity_id',db.Activity), > >>> Field('activity_date','datetime', requires=IS_DATE()), > >>> Field('effort') > >>> ) > >>> > >> > >> Thank you. Which database engine are you connecting to? > >> > >> /dps > >> > >>> > >>> On Tue, Aug 9, 2016 at 11:11 PM, Dave S <[email protected]> wrote: > >>> > > >>> > > >>> > On Tuesday, August 9, 2016 at 9:09:08 AM UTC-7, madhu nomula wrote: > >>> >> > >>> >> Hi, > >>> >> > >>> >> I am trying to read date output from controller, but I am getting > >>> >> value in > >>> >> View as decimal values: > >>> > > >>> > > >>> > Which DB backend are you using? > >>> > > >>> > Can you show your define_table() code? > >>> > > >>> > /dps > >>> > > >>> > > >>> >> > >>> >> > >>> >> controller Code: > >>> >> > >>> >> rowslistPeriod = db(( > >>> >> (db.AM.resource_id==db.auth_user.id)& > >>> >> > >>> >> (db.auth_user.id==auth.user.id) > >>> >> > >>> >> > ).select(db.auth_user.first_name,db.db.Solution.solution_code,db.Activity.activity_name, > > > >>> >> db.AM.effort, db.AM.activity_date) > >>> >> return dict(recordlistPeriod=rowslistPeriod > >>> >> > >>> >> > >>> >> View Code: > >>> >> > >>> >> $(containerPreviousRecords).append('{{for x in > recordlistPeriod:}}'); > >>> >> > >>> >> > >>> >> var ceffort= {{=x.AM.effort}}; > >>> >> var cDate= {{=x.AM.activity_date.strftime("%m/%d/%Y")}}; > >>> >> alert(cDate); > >>> >> > >>> >> > >>> >> ----------------- > >>> >> > >>> >> Here I am able to get number value (effort), when I am getting > alert > >>> >> getting x.AM.activity_date.strftime("%m/%d/%Y") values as > >>> >> decimal(0.0036789......) instead of Date. > >>> >> > >>> >> Please help me to get date. > >>> >> > >>> >> Thanks, > >>> >> MC > >>> > > >>> > -- > >>> > Resources: > >>> > - http://web2py.com > >>> > - http://web2py.com/book (Documentation) > >>> > - http://github.com/web2py/web2py (Source code) > >>> > - https://code.google.com/p/web2py/issues/list (Report Issues) > >>> > --- > >>> > You received this message because you are subscribed to the Google > >>> > Groups > >>> > "web2py-users" group. > >>> > To unsubscribe from this group and stop receiving emails from it, > send > >>> > an > >>> > email to [email protected]. > >>> > For more options, visit https://groups.google.com/d/optout. > > > > -- > > Resources: > > - http://web2py.com > > - http://web2py.com/book (Documentation) > > - http://github.com/web2py/web2py (Source code) > > - https://code.google.com/p/web2py/issues/list (Report Issues) > > --- > > You received this message because you are subscribed to the Google > Groups > > "web2py-users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

