INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: [Feature Request] DateTime values in epoch format  (Read 574 times)

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2729
[Feature Request] DateTime values in epoch format
« on: January 06, 2025, 03:35:19 am »

Hi @Matt, Happy New Year!

I think it would be nice to support Epoch timestamps (seconds since 1970) without having to do math:

- Add a mode to Now():
   mode 0 = current format, default
   mode 1 = epoch timestamp (for current timezone/location)
   mode 2 = epoch timestamp in milliseconds (for current timezone/location)

- Small change to FormatDate() and CompareDates() so that any DateValue larger than 86400 is interpreted as an Epoch timestamp. 86400 is reasonable as it corresponds to about 236 years in the normal MC date format, but just one day in epoch calendar.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42515
  • Shoes gone again!
Re: [Feature Request] DateTime values in epoch format
« Reply #1 on: January 06, 2025, 07:06:06 am »

Sure thing.

Next build:
NEW: Added a mode to the Now expression to return the seconds since 1970 instead of days since 1900.
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2729
Re: [Feature Request] DateTime values in epoch format
« Reply #2 on: January 06, 2025, 07:33:25 am »

Thanks!
Will FormatDate() also work with epoch values?
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42515
  • Shoes gone again!
Re: [Feature Request] DateTime values in epoch format
« Reply #3 on: January 06, 2025, 08:21:21 am »

Not yet. It seems like a parameter might be better than trying to figure it out automatically?
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2729
Re: [Feature Request] DateTime values in epoch format
« Reply #4 on: January 06, 2025, 08:32:00 am »

Your call, but I think inference is fine as Epoch values are so high that they don't really make any sense as a standard MC timestamp.
A mode makes sense if more formats are to be added, like:
mode 0 = MC time
mode 1 = epoch time
mode 2 = epoch time with milliseconds
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 439
Re: [Feature Request] DateTime values in epoch format
« Reply #5 on: January 06, 2025, 08:41:40 am »

Hey Matt any chance for an option in how to show the date format? Instead to have the default d/M/yyyy hh:mm:ss pm/am? Something like excel does. You can select different way to show the date. Right now to achive this is to use different expression fields.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2729
Re: [Feature Request] DateTime values in epoch format
« Reply #6 on: January 06, 2025, 09:33:47 am »

You can use FormatDate() to display a date in any format you want. The default display format is defined by your Windows Regional settings.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42515
  • Shoes gone again!
Re: [Feature Request] DateTime values in epoch format
« Reply #7 on: January 06, 2025, 10:11:20 am »

Your call, but I think inference is fine as Epoch values are so high that they don't really make any sense as a standard MC timestamp.
A mode makes sense if more formats are to be added, like:
mode 0 = MC time
mode 1 = epoch time
mode 2 = epoch time with milliseconds

Next build also:
Changed: Made FormatDate and CompareDates interpret any number over 86400 as a time value instead of days since 1900.

Thanks.
Logged
Matt Ashland, JRiver Media Center

SkGe

  • Galactic Citizen
  • ****
  • Posts: 439
Re: [Feature Request] DateTime values in epoch format
« Reply #8 on: January 06, 2025, 10:29:09 am »

@zybex.
I know that formatdate() you can set the time whatever you want. I'm talking when using a custom date field it uses the default d/M/yyyy hh:mm:ss pm/am. That one you can't change or can be change in windows? I can try to see if the way my regional settings are in windows.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2729
Re: [Feature Request] DateTime values in epoch format
« Reply #9 on: January 06, 2025, 01:17:40 pm »

Yes, you can change the default format in Windows settings - it's a bit hidden though.

For any standard Date field like [Date], [Date Imported], [Date Modified], etc, you can always get the underlying numeric/raw value and then format it with FormatDate():

formatDate([Date Imported, 0], dd-MM-yyyy HH:mm)
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 439
Re: [Feature Request] DateTime values in epoch format
« Reply #10 on: January 07, 2025, 03:02:31 am »

I really don't want to go windows way and modify date and time just to be shown in MC, It can mess with other settings in my windows and I don't want it.
Maybe a way to be able to do in MC as an option as a feature request.
Only Matt and team can say if they think or not about it (finger cross :P)
Logged

HPBEME

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1117
  • Goodnight and Good Luck
Re: [Feature Request] DateTime values in epoch format
« Reply #11 on: January 07, 2025, 08:55:37 pm »

Unfortunately this change messed up an expression I have been using in the status bar and the player bar.  If([Last Played,0], CompareDates([Last Played,0], Now()) ago, Never) 

I copied it from a post by lepa I think, but I can't remember for sure. It used to return time elapsed since a track was last played and automagically appended the appropriate units, whether that was minutes, hours, days, or years.  Now it only shows 0.00.

I have been experimenting using zybex's Zelda expression evaluator, but I unable to make it to show what it used to.  I'm not particularly skilled with expressions, so if somebody could a help me figure it out, I would greatly appreciate it.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2729
Re: [Feature Request] DateTime values in epoch format
« Reply #12 on: January 08, 2025, 03:01:09 am »

Yes, looks like CompareDates() is now broken for normal date values. Don't change your expression, this needs to be fixed on a next build.

@Matt, looks like it's working for Epoch values but not for values < 86400.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42515
  • Shoes gone again!
Re: [Feature Request] DateTime values in epoch format
« Reply #13 on: January 08, 2025, 06:35:59 am »

Thanks. CompareDates will be sorted next build.
Logged
Matt Ashland, JRiver Media Center
Pages: [1]   Go Up