Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm very new to WordPress. I need to get the date of a post and compare that date to a specific date (04/01/2011), so add some banners and stuff to every post created "after" that pivot date. But the only functions I found in the wordpress documentation are examples of functions to "print" the date, like the_time(), etc.

Anyone knows how I could made this thing?

Thanks in advance!!!

share|improve this question

2 Answers 2

get_the_date and/or get_the_time will return the date/time of the post rather than printing it.

share|improve this answer
    
Some sample would be appresiated... –  user4634 Apr 13 '11 at 14:32
    
@Nathan The function names in my answer are links to the WordPress codex pages for these functions. Those pages include the sample/default code on their use. –  Manzabar Apr 13 '11 at 16:08

just use the following code

<?php echo the_time(get_option('date_format'));?>

to get the time in any of wordpress page if you want to get the date then use just the following code

<?php echo the_date(get_option('date_format'));?>

i think that code solve the problem. :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.