Display todays date without time

I am trying to display todays date and some previous dates. I am using this variable in the screenshot but it also displays time too, can I turn off displaying time? is there an alternative variable I could be using?

There’s a full list of Date and Time properties here.

If you’re looking to return something like Monday 6 April 2020, you would do it as:
[[Now.getDayOfWeek()]] [[Now.getDate()]] [[Now.getMonthName()]] [[Now.getFullyear()]]

Now.getDay returns a number for the day of the week, rather than the day of the week itself or the date of the month. It’s a confusing name.

Thanks Dave,

I have not tried it yet, but I need to have some dates in the past (in my demo I need to simulate previous version dates) I’m thinking that the logic below with (-3) would not work to get the day 3 days ago and the date 3 days ago:

[[Now.getDayOfWeek(-3)]] [[Now.getDate(-3)]] [[Now.getMonthName()]] [[Now.getFullyear()]]

It will work for Now.getDate, although you need to put the ‘-3’ outside the brackets, like this:
[[Now.getDate()-3]]

I’m not sure how you modify ‘GetDayofWeek’ to get a previous or future day. I’m guessing there’s a way to do it by chaining functions together.

1 Like

Thanks Dave that helped!

[[Now.addDays(-3).getDayOfWeek()]]

1 Like

Ah, spot on, thanks.

So, your total string would be [[Now.addDays(-3).getDayOfWeek()]] [[Now.getDate()-3]] [[Now.getMonthName()]] [[Now.getFullyear()]]

The only limitation to this is that I think it would break when the -3 date was in a different month to the current date - it would show the current month, not the previous one.

1 Like

Thanks, that’s again very helpful and worked a treat!

Use addDays(-3) with every expression there, not just the one. Currently some of them are referencing a date 3 days ago while all are referencing the current date, so they won’t match up.

Ah, of course. I didn’t know that it was that flexible.

Right, so the revised, month-end-proof string would be [[Now.addDays(-3).getDayOfWeek()]] [[Now.addDays(-3).getDate()]] [[Now.addDays(-3).getMonthName()]] [[Now.addDays(-3).getFullyear()]]

I wish these functions were better documented, with more examples. I know a lot of them are directly related to equivalent Javascript functions, but not everyone who uses Axure (I’d guess the majority in fact) also uses Javascript.

@Alyssa_Axure - are there any plans to extend and make more useful the Math, Functions and Expressions page in the documentation? These are some of the most powerful and useful things that Axure can do and can save huge amounts of time, but if you’re not familiar with Javascript it takes a lot of trial and error.

Hi!

Off the top of my head I’m not specifically aware of upcoming plans for that page, but I’m happy to let our documentation team know that there’s interest in more examples and expanded details for that page! I’ll pass this along. :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.