News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Custom Time

Started by lordtron, September 06, 2008, 01:19:06 AM

Previous topic - Next topic

lordtron

SMF: 1.1.5

How would I be able to customize the time output.

Instead of having September 05, 2008, 10:17 pm

I would like it to output as:
September 05, 2008
10:17 pm

VainSoftGames.com - New Design To Gaming

Bulakbol

You can try. Admin => Features and Options => Default time format [ %B %d, %Y<br />%I:%M:%S %p ]
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

lordtron

I don't want to change how the time looks on all the pages. I just want to change it on a custom page I am making.

So I will need the code to do that.

VainSoftGames.com - New Design To Gaming

Smoky "Rider" Blue

you could try using ssi, and make sure you do the following:

To use SSI.php in your page add at the very top of your page before the <html> tag on line 1:
<?php require("your url to your ssi file here"); ?>


and finding the function of "time" and placing it where you want it to show up..

hope this helps ;)
**Take the time to remember friendships and family.. Sometimes it's all we have, and missed very much**

Bulakbol

You can use something like

$date = strftime('%b %d, %Y', forum_time());
$time = strftime('%I:%M:%S %p', forum_time());
echo $date, '<br />', $time;

Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

[SiNaN]

As a note, if you are trying to format a date you got from db, use this:

timeformat('date''format')
Former SMF Core Developer | My Mods | SimplePortal

lordtron

I don't know exactly how or where to put timeformat('date', 'format') in my coding, everyway I tried to do it, I either get an error or format just shows up instead of the time.

VainSoftGames.com - New Design To Gaming

[SiNaN]

Example:

timeformat($row['time'], '%H : %M : %S');
Former SMF Core Developer | My Mods | SimplePortal

Advertisement: