Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2007-04-01 22:07:04

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Sort order using a custom date field?

Oops again, there was a closing ) missing at the end of both if lines.

Offline

#26 2007-04-01 22:18:37

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: Sort order using a custom date field?

Ah yes (slaps head). Now it works fine. Ruud, together with %#d that is just perfect!

The only other change I made except for the custom field names was in the date order "%#d", "%#d %b", and "%#d %B %Y".
Thanks for staying up late and fixing it.


TXP Builders – finely-crafted code, design and txp

Offline

#27 2007-10-12 16:06:16

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: Sort order using a custom date field?

Hi Ruud.

I’m sorry, but I need your help again :)

I thought this thread could answer my question, but I have an error…

I have to compare today’s date between two other dates stored within 2 custom_fields with a “if” condition.
The purpose is to calcule a reduce price (strored within a custom_field) from a period date (ie. 15-10-2207 to 15-11-2007 : this price minus 10%)
Whatever I’d try, I’ve got the same (first unixdate php) display : 01.01.1970.

Could you help me, please?

Tks Ruud by advance.

Last edited by Pat64 (2007-10-12 16:06:59)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#28 2007-12-03 13:44:31

Qwest
Member
From: London, UK
Registered: 2007-01-24
Posts: 112

Re: Sort order using a custom date field?

ruud wrote:

If you want to order by date, you’d have to write dates like: 2007-04-21
For display purposes, you can convert that to a more pleasant looking date, using some PHP: <txp:php>echo strftime('%B %d, %G', strtotime(custom_field(array('name'=>'custom1 label'))));</txp:php>

Ruud, help! lol!

thanks for the help you’ve provided previously. I’ve been using the above code perfectly for the last couple of months! Wooo!

However, i’m adding an event which takes place on New years eve, so the date is 31st Dec 07, or 2007-12-31 which i’ve added to the custom field. But, upon viewing the page, it shows “31st December 2008” Any idea why it’s showing 2008? I changed teh date in teh custom field to 2007-12-30, and it put it back to 2007?!

Any ideas?!

Scrub that, i had a quick gander at php.net and then changed a few bits, and it works fine now… Notably, i changed %G to %y

Last edited by Qwest (2007-12-03 13:50:21)

Offline

Board footer

Powered by FluxBB