3060 Posts in 864 Topics by 646 members
| Go to End | Next > | |
| Author | Topic: | 696 Views |
-
formatting date on results of custom query?

11 November 2011 at 6:09am
Is there a way to format the date in the results of a custom query? I have the date selected from the table as Date, but then in the control on the page where I'm using the query, $Date returns the date in a format I don't want on that page, and things like $Date.Nice and $Date.format(M) all return nothing.
-
Re: formatting date on results of custom query?

12 November 2011 at 2:58am Last edited: 12 November 2011 3:00am
$customQueryObj->Date = DBField::create('Date', $customQueryObj->Date);
-
Re: formatting date on results of custom query?

12 November 2011 at 8:26am
I don't understand what you're trying to say. Where are you suggesting I put that?
-
Re: formatting date on results of custom query?

12 November 2011 at 9:57pm
Your custom query returns the date as a string. You will need to iterate the results of your query and reapply the date object to your date value before you return the data to the template.
-
Re: formatting date on results of custom query?

16 November 2011 at 12:57am
Hi ya,
Not sure if this is what you're after,
when i've got a data object page and i've wanted to get the short month of a date so used
public function getMonth() {
return $this->obj('CalloutDate')->ShortMonth();
}this then meant i could use $CalloutDate.ShortMonth on the template in the control.
you can do the same for nice.
Mick
-
Re: formatting date on results of custom query?

22 November 2011 at 3:37am
Thanks for the suggestions. I'll look into this and see if I can get it working properly.
-
Re: formatting date on results of custom query?

26 December 2011 at 3:32am
I experimented with this at length, couldn't get it to work, decided to leave it alone awhile, came back to it, still can't get it to work.
| 696 Views | ||
| Go to Top | Next > |



