close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

convert timestamp to date as text

Thread began 6/15/2011 11:59 am by Jenny I | Last modified 6/16/2011 3:44 pm by Jason Byrnes | 1088 views | 7 replies |

Jenny I

convert timestamp to date as text

Hi

I have manged to work out how to convert a timestamp to uk date

  <?php echo date('d-m-Y',strtotime($row_WADAmyTable["Date"])); ?>  



this outputs e.g 15-06-2011

but what I really need is to display 15-Jun-2011

Does any one know how I would code this?

Sign in to reply to this post

Jason ByrnesWebAssist

use a capitol M to show a text string Month abbreviation:

php:
<?php echo date('d-M-Y',strtotime($row_WADAmyTable["Date"])); ?>




see the php date manual page for more details:
function.date.php

Sign in to reply to this post

Jenny I

Thanks once again Jason,

That is working perfectly

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Jenny I

Hi Jason

Just one more quick question.

How would I write the code to get date and time so

16-Jun-2011 19:30

Thanks in advance

Sign in to reply to this post

Jason ByrnesWebAssist

refer the php data manual page:
function.date.php

they list all of the parameters to pass in to get the format you want.

  H 24-hour format of an hour with leading zeros 00 through 23  




and:

  i Minutes with leading zeros 00 to 59  




so that would mean changing your code to:

php:
<?php echo date('d-M-Y H:i',strtotime($row_WADAmyTable["Date"])); ?>
Sign in to reply to this post

Jenny I

Hi Jason,

Thanks for this. That was the same code I had but I was missing one of the ending brackets thats why i thought I had it wrong.

Thanks for your help

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...