Jump to content


Photo

Date Format syntax *solved*


  • Please log in to reply
5 replies to this topic

#1 cyprus

cyprus
  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 17 September 2006 - 07:41 AM

I am tring to make my dates look easier to read in a list. I have tried the following, as well as numerous permutaions!! Thanks

case 'UnitPrice':$val = '£' . number_format($val,2); break;
case 'Qty':    $val = number_format($val, 0) . ' off'; break;
case 'RunningTotal':      $val = '£' . number_format($val,2);break;
case 'Orderdate':      $val = .date_format(date("j-M-Y", strtotime(['Orderdate']))); break;



#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 17 September 2006 - 07:48 AM

And ...
Legend has it that reading the manual never killed anyone.
My site

#3 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,025 posts

Posted 17 September 2006 - 08:09 AM

date_format() ??? Still got your VB hat on.

Try
case 'Orderdate':   $val = date("j-M-Y", strtotime($val)); break;

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#4 cyprus

cyprus
  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 17 September 2006 - 09:52 AM

Thanks again Barand. VB Hat?, so it still shows does it? I wish it was in VB. What you did worked as ever, thanks again. While there, do you know of any packages that enable HTML to be written around PHP. Sorry to admit I normally cheat and use Frontpage to do all the HTML side, ie making pages look smart, and then go into writing the PHP bits so that I can place things in tables. If I work backwards, then I get in a mess and my page gets created in a tabular form, wasted page areas. Thought I would just ask, thanks again.

#5 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,025 posts

Posted 17 September 2006 - 10:17 AM

I tend to to echo the HTML code from within PHP and avoid wysiwyg editors - I like to be in control.

(I use Nusphere PHPEd - editor, instant manual lookup, code insight, debugger, profiler, edit via ftp, remote debugging, db client interface etc etc.

For tables of data I use my baaGrid class (see my sig, bit like .net datagrid)

include 'baagrid.php';
$grid = new baaGrid("SELECT bla FROM tablename");
    // optional formatting options go here
$grid->display();

Done - instant table, but lots of formatting options too. (End of plug).

I was wondering why you opted for the SELECT to display the returned data rather a conventions table, which would give a far more flexible method of displaying the results?
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#6 cyprus

cyprus
  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 17 September 2006 - 11:06 AM

Thanks. That Baagrid is something else!! I miss all my VB goodies like Flexgrid etc. Feel almost homesick now. Certanly very useful, probably a bit expensive for light useage. Had I gone the other way, ie insert checkboxes first instead of programatically growing them, I'd know where they were going to appear. Aynhow all good fun if you can survive it. Regards




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users