views:

85

answers:

2

Hello,

I currently am displaying dates as follows "yyyy/mm/dd" in a wordpress blog (it needs to be input in this format because a plugin is using it to define a post expiration date). I want to use jQuery to locate all of these strings on a page (they're all in table cells) and reformat them to "mm.dd.yy"

The site is:

http://www.beattrainsoundsystem.com/category/gigs

The dates also exist in the footer on every page which I would also like to change.

Thanks!

+3  A: 

Why not change the date format before it's rendered to the page? I imagine somewhere in the template you've got something like:

<td><?php echo $something['date']; ?></td>

Just change it to this:

<td><?php echo date('m.d.y',strtotime($something['date'])); ?></td>

Using JavaScript, IMO, isn't the correct move here. If you want to post the part of the Wordpress template that renders this data, we can give you more specific help with doing it via PHP.

inkedmn
I don't know if I can include code in this comment box... I'm going to respond in an answer.... thanks!
j-man86
A: 

The following ended up working. Thank you inkedmn.

<?php $_atropos_expiration_date = get_post_meta($post->ID, '_atropos_expiration_date', true); echo date('m.d.y',strtotime($_atropos_expiration_date)) ?>
j-man86
Awesome! Happy to help.
inkedmn