开发者

how do I: setup date function in node output to format date from to - date to, then start and finish times

currently the output from my date field entries reads like this Sun, 25/04/2010 - 10:00am - Sun, 02/05/2010 - 5:00pm but I would prefer it to read like this Sun, 25/04/2010 - Sun, 02/05/2010 10:00am - 5:00pm is there a drupal beginner way of doing this?开发者_运维问答


Yes, you need to site Configuration -> Date and Time -> Formats -> Add Formats

Here you can plug in PHP date function elements to create new displays. The link to the PHP date format page is http://php.net/manual/en/function.date.php.

For instance:

g:i    results in 15:45 

G:i A  results in 3:45 PM

and so forth...

Once you have added the format in Drupal, you will see it in views and in the CCK diplay area as a choice for date display.

Updated Ok, I see. I just built a timesheet application for our company intranet built on the drupal platform. I separated the times from the dates by making them all separate fields. In other words, instead of one date field with a "to" and "from" with all levels of granularity. I made three fields.

  1. To and From Date (displayed as June 3, 2010)
  2. Start Time (displayed as 7:00am)
  3. End time (displayed as 7:00am)

On the input side, it's exactly the same; and, you can create a custom tpl.php file to theme your form (view or edit) to look how you want.

Otherwise, that date field spews out as one string, and there isn't too much that can be done with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜