so i'm working on a band website.

they have a discography page. for each album, they input a release date in a date field.

they have a new record coming out in a few months. it got me thinking, that if i could compare the site date to the user input date, before it comes out, i could print "coming soon," until it comes out, and then "out now!" for a period of a few weeks after the release.

i have a very basic understanding of how this would work, but i can't figure out how to call the site date. does anyone know?

Comments

hunterchristy’s picture

okay, so after extensive googling, i think i am on to something.

i can make this: 'tz_handling' => 'site' an array, and then use the $output from the views in my "views-view-field-releasedate.tpl.php" file to compare the two...i think.

sleep now...will convert to unix epoch tomorrow.

hunterchristy’s picture

so here's what i've got right now. and it's not working.

i'm doing this in views, and i have "field_releasedate_value_1" spitting out a unix string. and i can, for instance, say "print $release" and it will print said string. AND i can print $today and get a string. BUT trying to print $unix isnt working, nor is trying to compare the two.

<?php
$today = date(U);
$release = $fields['field_releasedate_value_1']->content;
$unix = date("U", strtotime($release));
$soon = 'COMING SOON!';
$space = ' ';
if ($unix > $today) {
	print $space;
    print $soon;
}	else {
print $space;
}
?>

can someone kick me in the right direction?

arlinsandbulte’s picture

Status: Active » Postponed (maintainer needs more info)

@hunterchristy
Did you get it solved?

karens’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

No response, closing.