hunterchristy Posted August 25, 2009 Share Posted August 25, 2009 so i'm working on a band website. they have a discography page. for each album, they input a release date. they have a new record coming out in a few months. it got me thinking, that if i could compare the local 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 local date. does anyone know? Quote Link to comment Share on other sites More sharing options...
Bendude14 Posted August 25, 2009 Share Posted August 25, 2009 when you say local date are you after a specific time for that user? Can you not just use todays date compared to the release date? Just look on the php.net site at the date functions.... Quote Link to comment Share on other sites More sharing options...
hunterchristy Posted August 25, 2009 Author Share Posted August 25, 2009 ahhh. you're correct, i should have been more specific. technically, i want the SITE's date. this is for a drupal site and after a bunch of searching and searching and searching, i found they specify this: 'tz_handling' => 'site' for the site's date. i'm still working on it. once i THINK i'm onto something, i'll post my noob code for ya'll to have a chuckle at. Quote Link to comment Share on other sites More sharing options...
hunterchristy Posted August 29, 2009 Author Share Posted August 29, 2009 so here's what i've got right now. and it's not working. i'm doing this in views in drupal, 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.