Author Topic: New date variable  (Read 949 times)

Tags:
  • All members
  • Posts: 42
  • Karma: +2/-0
New date variable
« on: Fri, 05 February, 2021, 12:15 »
Hi team,

We have a variable now_time_datestr which return the date in the format dd/mm/yyyy.

Could we have a variable that reverses that, without the slashes as well. So in the format yyyymmdd. This would really help with sorting files etc into date order.


Reggie

  • Administrator
  • Posts: 8924
  • Karma: +335/-2
  • Gender: Female
*
Re: New date variable
« Reply #1 on: Tue, 09 February, 2021, 16:55 »
I'm sorry, there is no quick solution for this, as somebody else would want this in yyyy-mm-dd format or dd.mm.yyyy, etc. Unfortunately, this is not a full-fledged programming language, so we can't afford this level of flexibility.

You could maybe use the variable as is and later just remove the slashes using some third-party software?
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Usuários brasileiros, bem vindos ao nosso WhatsApp chat!

Присоединяйтесь к нашей официальной группе ВКонтакте!

  • All members
  • Posts: 32
  • Karma: +7/-0
  • Gender: Male
Re: New date variable
« Reply #2 on: Wed, 10 February, 2021, 21:53 »
Possible workaround: If having the date in the filename doesn't matter and you just want the files in date order, then using 'now_time' instead of 'now_time_datestr' would do this - file names would run from lowest number (oldest log) to highest (newest log), with the number increasing by 1 each day. Assuming you're taking the logs into excel then you can get the actual date in the log by applying custom formatting to the cell with the 'now_time' value.

  • All members
  • Posts: 42
  • Karma: +2/-0
Re: New date variable
« Reply #3 on: Thu, 11 February, 2021, 11:46 »
No problem Oxa, I wasn't sure how the variable now_time_datestr variable was built. I thought it might formed by already having the year, month and day as separate values. Thanks for getting back to me.


Purity,

I think you're on to something here. Using now_time by itself wouldn't work as each entry would be a different file and I want just one file per day. If I use INTEGER(now_time) however, I think this'll do what I'm after. Thanks for pointing me in the right direction.


Reggie