1
revtiernan
Changing time format
  • 2003/12/31 23:14

  • revtiernan

  • Just popping in

  • Posts: 3

  • Since: 2002/12/4


Several of my users have requested that the timestamps on the forums (and other modules) be changed to reflect 12-hour instead of 24-hour clock time, ie. am/pm format. Is there a way to do this? (my apologies if this has been answered already somewhere, I've not been able to find it).

Thanks

2
Dave_L
Re: Changing time format
  • 2004/1/1 0:02

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


That's determined by the following constants in language/english/globals.php:

define("_DATESTRING","Y/n/j G:i:s");
define("_MEDIUMDATESTRING","Y/n/j G:i");
define("_SHORTDATESTRING","Y/n/j");


The format strings are used by the PHP function date.

So you could change "Y/n/j G:i:s" to "Y/n/j g:i:s a" and "Y/n/j G:i" to "Y/n/j g:i a".

3
svaha
Re: Changing time format
  • 2004/1/1 2:45

  • svaha

  • Just can't stay away

  • Posts: 896

  • Since: 2003/8/2 2


Hi Dave,
Is it also possible to change the Y/n/j to j/n/Y so that I would get the date like 31 12 2003?
Aloha

4
CBlue
Re: Changing time format

I can answer for Dave, svaha! Yes it is possible to change the date format around.

5
svaha
Re: Changing time format
  • 2004/1/1 2:48

  • svaha

  • Just can't stay away

  • Posts: 896

  • Since: 2003/8/2 2


My God, you're quicker than the Eye, must be super woman (or catwoman)
Thnx

6
CBlue
Re: Changing time format

Just call me Super Woman! Or maybe Xooper Woman!

7
revtiernan
Re: Changing time format
  • 2004/1/2 6:22

  • revtiernan

  • Just popping in

  • Posts: 3

  • Since: 2002/12/4


Thank you, Dave - worked perfectly! :)

8
fredski
Re: Changing time format
  • 2004/1/27 12:35

  • fredski

  • Quite a regular

  • Posts: 265

  • Since: 2004/1/26


I found that very usefull, now although my modules show the timestamp in the format that I want, I now need to display the time in my theme header next to the date. I already have the date there using:
// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
function makeArray(n) {
this.length = n
return this
}
monthNames = new makeArray(12)
monthNames[1] = "January"
monthNames[2] = "February"
monthNames[3] = "March"
monthNames[4] = "April"
monthNames[5] = "May"
monthNames[6] = "June"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "October"
monthNames[11] = "November"
monthNames[12] = "December"
function dateString(oneDate) {
var theMonth = monthNames[oneDate.getMonth() + 1]
var theYear = oneDate.getFullYear()
return theMonth + " " + oneDate.getDate() + ", " + theYear
}

function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->

Now just need to get the time in there, Anyone know how to do this??? Please

9
kahumbu
Re: Changing time format
  • 2004/1/27 13:23

  • kahumbu

  • Documentation Writer

  • Posts: 277

  • Since: 2003/8/23


For both date and time, you can use this short script anywhere in your theme.html.

<{php}>
echo 
formatTimestamp(time());
<{/
php}>



Login

Who's Online

403 user(s) are online (338 user(s) are browsing Support Forums)


Members: 0


Guests: 403


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