Categories > TinyButStrong general >

single digit formats

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: RwD
Date: 2005-01-15
Time: 09:31

single digit formats

Hello,

I am revising a website I did a while ago which I tried not to work with tbs 2.x so for now I am stuck with version 1.95.1. I want to have it (and also v2.x) to have an additional formatting option for the dates.

Is it possible to not only format 2 digit hours, minutes and seconds but 1 digit formats as well? If not in the official 2.x versions, can you show me where to im plement it in the 1.95.1 version??

Thanks!
By: Skrol29
Date: 2005-01-15
Time: 15:26

Re: single digit formats

Hi,

TBS Formats haven't changed between versions 1.95 and 2.x.
This feature is based on the Php function date(), and strftime() for the local option. But those Php functions don't enable us to format minutes and seconds without leading zeros. Hours can be formated without leading zeros only for date().

So I can give to you only the line that can make TBS support hours one 1 digit. If you also need minute and second, it is better to code a 'onformat' or 'onsection' user function  which use the Php function getdate() to retrieve the information.
By: RwD
Date: 2005-01-16
Time: 00:35

Re: single digit formats

To be honest I think it is a missing funtion in tbs too. Most formatting systems have the single digit hour, minute and second.

I will look up the correct part in the class and change it for this one website, for this one tbs class. It is not urgent, the javascript taking the value also processes with the leading zero, but does complain about it!
By: Skrol29
Date: 2005-01-17
Time: 10:56

Re: single digit formats

I agree with you.
I'll see if I can give a smart issue for the next version.

The functions to edit in the TBS source are tbs_Misc_Format() and tbs_Misc_FormatSave().
tbs_Misc_FormatSave() is called by tbs_Misc_Format() only, and its purpose is to translate a TBS format into a Php format, and put it in cache.
tbs_Misc_Format() simply apply a TBS format to a value.