Compare date/time with current time in customized view template in drupal

Events happening in the community are now at Drupal community events on www.drupal.org.
subu.purohit's picture

Hi,

I have a field called field_streaming_date (datetime) under blog content type. I created a blog listing view and selected title,body and streaming date under view fields and override it with views-view-fields--blog.tpl.php. Now I have to display some text according to streaming_date field:

If streaming date < current date/time : print "streamed";
If streaming date == current date/time : print "streaming";
If streaming date > current date/time : print "not streamed";

I converted current time in timestamp using : <?= strtotime(date('y-m-d H:i:s'))?>
but I am not able to convert streaming_date in timestamp.

Does anyone know about how to convert it into timestamp so that I can compare it with cuttent timestamp. Or is there an other way to compare these two dates.

Thanks
Subhash

Comments

Ok! I got solution. I used

subu.purohit's picture

Ok! I got solution. I used node_load($fields['nid']->content) in view template file. this function gave me field_streaming_date in proper datetime format then I used strtotime function to convert it into timestamp.
Now it is easy to compare it with current timestamp.

Thanks
Subhash

edit,delete Page Content in Drupal

kailash123's picture

How can Edit Page Content in Drupal.
Please anybody tell me steps.

Regards,
Kailash Singh
M:7827492235

Edit page

vjbakshi21's picture

just go to the content management- content
you can view edit or delete the content

vijay baskhi

how to create own theme with drupal

vjbakshi21's picture

Any on tell me about the adding own theme

vijay baskhi

Once you get the HTML pages

yogesh1110's picture

Once you get the HTML pages from your designer team then you have to choose one pages, so that you can convert it into page.tpl
Once you create page.tpl file then you can replace your content with the regions. Also you have to inclulde $style and $script variales to include css and Js.
After that you just need to enable the theme.

You have to create theme

gomesh's picture

You have to create your own theme or add theme to drupal .

Delhi

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: