1
reden
date without time
  • 2004/10/28 14:43

  • reden

  • Just popping in

  • Posts: 8

  • Since: 2002/10/4


hi ... first of all i would like to thank you for this beatifull software .. but i got a prob i want to insert in my news table on the news page the date of the news but not the time ...

how can i do that ?? can u help me plz ?? i love u all

2
m0nty
Re: date without time
  • 2004/10/28 16:38

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


you need to edit xoops_root/language/english/global.php

these lines:

define("_DATESTRING","jS M Y G:i:s");
define("_MEDIUMDATESTRING","d/m/y H:i");
define("_SHORTDATESTRING","j/n/Y");

however this would affect the site globally.. ie even the forum would not show time anymore..

i'm not sure if it can be done through the template, but if you look for anything in the news module files that refers to date as datestring or mediumdatestring, then you could edit the files in the news module to refer to shortdatestring instead as this definition does not include the time..

3
Mithrandir
Re: date without time

Somewhere in your News module is something like this:
$story['posttime'] = formatTimestamp($story['posttimestamp']);


Exact syntax and placement in files is different depending on your News module version

Change that to
$story['posttime'] = formatTimestamp($story['posttimestamp'], "s");

and you will get the "short" date format, which is defined in your xoops/language/[language]/global.php as _SHORTDATESTRING - usually defined to just the date without time information.

Future News versions will let you configure this in the module configuration, I believe.

4
tl
Re: date without time
  • 2004/10/28 16:54

  • tl

  • Friend of XOOPS

  • Posts: 999

  • Since: 2002/6/23


You would need to make the following modification.

old version of news module
file: news/index.php
$story['posttime'] = formatTimestamp($sarray[$i]->published());

change to
$story['posttime'] = formatTimestamp($sarray[$i]->published(), 's');

New version of news module
file: news/class/class.newsstory.php

locate under function prepare2show()
$story['posttime'] = formatTimestamp($story['posttimestamp']);

change to
$story['posttime'] = formatTimestamp($story['posttimestamp'], 's');


Back up your file first before you edit the file. You could alway revert back the original file if you were to make a mistake.

[edit] well, I was a bit late in reply [/edit]

5
Mithrandir
Re: date without time

Quote:

tl wrote:
[edit] well, I was a bit late in reply [/edit]
Yeah, but you got the syntax and file right for News 1.1, so that's ok

6
tl
Re: date without time
  • 2004/10/28 17:18

  • tl

  • Friend of XOOPS

  • Posts: 999

  • Since: 2002/6/23


Mith:
I have not tried yet. Just curious, why must be double quotes "s" not single quotes 's', or does it matter in case of the news module? I have been using 's' without any problem in some of my modules. Thanks.
tl

7
Mithrandir
Re: date without time

Shouldn't matter - both ' and " means that it is a string being sent as a parameter. I usually just choose the one, that's closest at hand - sometimes it's a ' sometimes it is a "...

Login

Who's Online

279 user(s) are online (192 user(s) are browsing Support Forums)


Members: 1


Guests: 278


Runeher2,

more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits