ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

EE $LOC->decode_date vs. PHP date()

December 07, 2007 5:24pm

Subscribe [2]
  • #1 / Dec 07, 2007 5:24pm

    Brian M.

    529 posts

    I’m curious - I need to use PHP to get the current date to slap into a weblog entries tag as a parameter.  I can either use the EE function $LOC->decode_date(all the date/time formatting goodies)  or the PHP function date(all the date/time formatting goodies).

    Why should/would I use one over the other?  What about performance - seems like date() would be faster wouldn’t it (I know it’s a matter of milliseconds probably, but just curious).

    Thanks!

  • #2 / Dec 07, 2007 5:29pm

    Lisa Wess

    20502 posts

    Why can’t you just use {current_time}?

  • #3 / Dec 07, 2007 5:44pm

    Brian M.

    529 posts

    Hmm well you’re right I can. I can’t keep track of all the tags available - I thought there was one but I couldn’t find it…

    I was also unsure if this would work:

    start_on=”{current_time format="%Y-%m-%d"} 00:01 AM”

    It does as I’m sure you know. While I’ve got you here, 😉 Is there a better way to show all entries from only today (both expired and in the future) - I was going to use:

    start_on=”{current_time format="%Y-%m-%d"} 00:01 AM” stop_on=”{current_time format="%Y-%m-%d"} 11:59 PM”

    Thanks!

  • #4 / Dec 07, 2007 5:50pm

    Lisa Wess

    20502 posts

    I think that’s probably the best way; you might post in how to, to see if others have other ideas.  =)

    Also, I only thought of it because that only became usable in 1.6.1 in that manner. =)

  • #5 / Dec 07, 2007 6:03pm

    Brian M.

    529 posts

    You guys need to stop development for a couple years so I can figure out everything EE does and doesn’t do right now (I’ll let you know when I’m all caught up). Then I just need to keep up with the release notes and I’ll be all set!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases