Get current date?

  • 1
  • Question
  • Updated 5 years ago
  • Answered
Is there a way to get the current date to use in a template or a page title? It isn't a field in any model that I have on my page.
Photo of Peter Bender

Peter Bender, Champion

  • 6,246 Points 5k badge 2x thumb

Posted 6 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,004 Points 20k badge 2x thumb
The easiest way to do it would be to add a Formula field of type Date called "Today__c", whose formula is "TODAY()", on the object whose Model you'd use for the PageTitle component, and then include that field in that Model. Then you could use it like any other field.

There's currently no merge field in the Skuid API that just gives you the current date, but it would be nice to have one!
Photo of Jacob Flatter

Jacob Flatter

  • 1,512 Points 1k badge 2x thumb
Is this still true?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
If you don't mind going to javascript you can use this syntax:  

$.datepicker.formatDate('dd/mm/yy', new Date())

The JQuery datepicker format utilitity provides lots of ways to format the date.   (http://api.jqueryui.com/datepicker/)  
Photo of John Nelson

John Nelson, Product Manager

  • 3,234 Points 3k badge 2x thumb
Could also do this as well (from here: http://help.skuidify.com/s/tutorials/m/11720/l/129505-skuid-time): 
skuid.time.getSFDateTime( new Date() );
(Edited)