Current Date and Time Format

Sep 21, 2016

Hi There,

Can any one provide me source file of current date and time how it's works?

2 Replies
Alyssa Gomez

Hi Pranav,

I did a little digging, and it looks like you're going to need Javascript for this. This Screenr should point you in the right direction! You also might find these Javascript Best Practices and Examples to be helpful. 

If that's not exactly what you're looking for, try this forum thread. Best of luck to you on this project!

Robert Stewart

I use this javaScript routine:
1. locale can be formated to language 'en-us' 'fr-ca'
2. month: 'long' or 'short'
3. add additional JavaScript time ('objDate.getHour', 'objDate.getMinutes') to name a few.

function getDate() {
  var objDate = new Date(),
  locale = 'en-us', month = objDate.toLocaleString(locale, { month: 'long' });
  var day = objDate.getDate();
  var year = objDate.getFullYear();
  var str = month + ' ' + day + ', '+ year;
  // (str result: September 21, 2016);
  var player = GetPlayer();
  player.SetVar("yourStorylineVar",str);
}

getDate();

This discussion is closed. You can start a new discussion or contact Articulate Support.