Question

Photo of David Stevens

0

Get current date using Lava

According to the official Liquid repo, using 'Now' or 'Today' returns the current date and time.

I've tried several different variables in Rock to return the current date, but can't get anything.  Am I missing something?

  • Photo of Nick Airdo

    1

    I tried what's documented on the lava docs page on the demo site and  {{ 'Now' | Date:'M/d/yyyy' }} appears to work there: http://rock.rocksolidchurchdemo.com/page/192#.  Can you be more specific about what you've tried

    • David Stevens

      You're right, that works.


      I had tried 'Now', 'Date', 'Today', 'DateTime.Now', 'DateTime.GetDate' but it doesn't return anything unless the date format is specified. Ruby Liquid will return the date without having to specify a format.


      Thanks Nick!