Help - Search - Members - Calendar
Full Version: Formating Date/Time from First_Played field
Hydrogenaudio Forums > Hosted Forums > foobar2000 > General - (fb2k)
msobetzko
I'm very new to any form of customization. I am using playcount and trackinfo panel. I am displaying first_played field and the data looks like 20070731 for the date. I would like to see July 31st, 2007. What formatting functions are available to convert the date.

Mike
kanak
First off, i'm assuming that your format is indeed of the form YYYYMMDD (although i have never seen this format before).

Anyway, use this code:

CODE

$select($substr(%first_played%,5,6),Jan,Feb,Mar,Jun,July,Aug,Sep,Oct,Nov,Dec)' '
$substr(%first_played%,7,8)$ifgreater($substr(%first_played%,8,8),3,th,$select($add($substr(%first_played%,8,8),1),th,st,nd,rd))', '
$left(%first_played%,4)
msobetzko
QUOTE(kanak @ Aug 1 2007, 12:26) *

First off, i'm assuming that your format is indeed of the form YYYYMMDD (although i have never seen this format before).

Anyway, use this code:

CODE

$select($substr(%first_played%,5,6),Jan,Feb,Mar,Jun,July,Aug,Sep,Oct,Nov,Dec)' '
$substr(%first_played%,7,8)$ifgreater($substr(%first_played%,8,8),3,th,$select($add($substr(%first_played%,8,8),1),th,st,nd,rd))', '
$left(%first_played%,4)



Wow, works great. Thank you, I learned something.

Mike
Keikonium
I am wondering the same thing, but my timestamp is slightly different than the one explained in this thread:
CODE
2007-08-01 19:56:09


How would I go about making this display the same sort of thing (but ditching the time stamp part, and just keeping the date). I want that to display Aug. 1st, 2007.

Thanks!
Purple Monkey
You just need to change the numbers given to $substr: 5,6 -> 6,7 ; 7,8, -> 9,10 ; 8,8 -> 10,10.
Keikonium
After changing that, everything seems to work correctly, except for some minor glitches:

(image removed)

30st makes no sense, it should be 30th. Not to sure why this is. I am in the process of trying to fix it.


EDIT:

I messed a part up by mistake, all seems to work now!

But thank you very much for your help Purple Monkey smile.gif!
adam917
Wouldn't it make more sense (from a coding & simplicity sense) to use either "2007 Aug 1", "1 Aug 2007", or "Aug 1, 2007" (getting rid of the ordinal suffix that seems to be causing trouble)?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.