rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: Stonesteel on March 04, 2015, 08:41:29 AM

Title: Changing The Values of %item-modified% Into Date Only [SOLVED]
Post by: Stonesteel on March 04, 2015, 08:41:29 AM
Greetings!


could someone help me how to display only the date for the result of the variable %item-modified%? I just don't want to include the time in the result because it makes that section too long if it includes also the time. and also, is there a way that I can modify it to display the date the file was added to the hfs? not the date the file was modified.
Title: Re: Changing The Values of %item-modified% Into Date Only
Post by: Mars on March 04, 2015, 12:10:50 PM
this help you?

%item-added%
http://www.rejetto.com/wiki/index.php?title=HFS:_Template_symbols

You can find more help about HFS in wiki
http://www.rejetto.com/forum/html-templates/hfs-templates-vars-and-section-help/msg1010138/#msg1010138
Title: Re: Changing The Values of %item-modified% Into Date Only
Post by: Stonesteel on March 05, 2015, 01:27:52 AM
Thanks much Mars! I'm sorry I forgot we have that template symbols, and I ran on it before. Anyways that resolved the item added issue, but still there's a time attached to it, and it says (date and time format is defined by OS settings), is there a way that I could hide the time? I tried changing the settings in Region and Language section of the OS, but still no avail.
Title: Re: Changing The Values of %item-modified% Into Date Only
Post by: Mars on March 05, 2015, 06:12:38 PM
I suppose you want to do as those lines

Quote
[+file]
<td>%item-size%B<td>{.time|dd-mm-yyyy|%item-added%.}<td>%item-dl-count%

[+folder]
<td class='nosize'>folder<td>{.time|dd-mm-yyyy|%item-added%.}<td>%item-dl-count%
refer to wiki at
http://www.rejetto.com/wiki/index.php?title=HFS:_Time_format#Text_formatting

 ;)
Title: Re: Changing The Values of %item-modified% Into Date Only
Post by: Stonesteel on March 06, 2015, 01:44:52 AM
Thank you Mars! but here is the thing, there seems to be the problem on displaying the item added date, every time the hfs restart, the item displays the date added the time the client access the site, for example today (03-06-2015, 09:47AM), I accessed the site and displays the item added today not the item I added yesterday. Is this how item-added var works?


*I have an event like this in my hfs

[at 00:01]
{.stop server.}
{.start server.}


I added this to prevent the crashing of the hfs due to insufficient memory for running the hfs too long.
Title: Re: Changing The Values of %item-modified% Into Date Only
Post by: Stonesteel on March 06, 2015, 01:54:39 AM
herein attached is the screenshot of my site, kindly see red boxes.
scroll to the right to see the system date and time.

Title: Re: Changing The Values of %item-modified% Into Date Only
Post by: skb on March 06, 2015, 04:04:07 AM
As far as I know (from limited testing I did when I was wondering about using item-added), these timestamps are not preserved across server restarts.

However, as far as I can see, when items are uploaded, the new file that is created on the server gets the current date and time. Thus, the modification time saved by the OS (as shown via  %item-modified%) is generally the time the file was added.

(Perhaps an exception is if you are manually moving files from elsewhere into the real folders on your server, rather than uploading them via HFS. In this case, perhaps you could add something like the command line "touch" utility to update the modification times of the files you add to the current time as you add them.)

Steve
Title: Re: Changing The Values of %item-modified% Into Date Only
Post by: Stonesteel on March 07, 2015, 02:22:25 AM
Thank you for the inputs Steve, I am adding the files to the real folder manually, but first I am transferring it from a PC that downloads all the files then dump it to the PC host of the hfs, from a dump folder, then I manually move each file to their respective categories (movies, tv series, animes, applications, etc.). Therefore the timestamps of the %item-modified% maybe the time I added the file to the PC Host of the hfs (or added to the hfs, hehe). Maybe I should use %item-modified% then instead of %item-added%. In a keen observation and testing, I have found that the format given by Mars does not give the proper result. If I use this format,

{.time|dd-mm-yyyy|%item-added%.}

the result would always be the current time of your PC, as what I have read in this reference,

http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands (http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands)

time | A
returns current time information. The format is specified by parameter A.

the last parameter "%item-added%" thus will be ignored and will display only the current date and time. I tried changing it to

{.%item-added%|mmm-dd-yyyy.}

but the result is "macro error, not supported or illegal parameters". I also tried using only %item-added%, but the result is the same as "time", displaying also the current date and time when you access the site.

Then I switched back to %item-modified%....  :(
Title: Re: Changing The Values of %item-modified% Into Date Only
Post by: Mars on March 07, 2015, 03:27:22 PM
you can forget the macro TIME, it is not suitable actualy

The format given by %item-added% (%item-modified) is the following

29/12/2014 00:26:02

in fact, the thing to do is to keep only the necessary characters

Example: cut|2|3|abcdef will expand to bcd 
Example: cut|from=3|size=2|abcdef will expand to cd

{.cut|1|10|29/12/2014 00:26:02.} will expand to 29/12/2014

{.cut|1|10|%item-added%.}

it is possible to use a more complex shape using the numerical representation in time since a certain date

when  %item-modified% is "25/08/2013 08:38:03", %item-modified-dt% give  "41511.3597624421"

then it's possible to change the format by using {.time|format=yyyy-dd-mm|when=41511.3597624421.}  ==> 2013-25-08


{.time|format=dd/mm/yyyy|when=%item-modified-dt%.}  (cf: %item-added-dt%)
Title: Re: Changing The Values of %item-modified% Into Date Only
Post by: rejetto on March 07, 2015, 08:58:47 PM
%item-modified-dt% is not document yet, i will do it now.

Using {.time.} is the cleanest solution, because {.cut.} may not work on systems that format the date in a different way.
Title: Re: Changing The Values of %item-modified% Into Date Only
Post by: Stonesteel on March 10, 2015, 01:20:57 AM
wew!  :o  Never thought there were macros as complex as these.  ;D , anyways tnx much for the detailed explanation Mars! I've tried using %item-added% and %item-modified% using the format you gave, and yet still the %item-added% displays the current date and time of the system, so I've used the %item-modified% instead and I got the result I ever wanted to. Thank you also rejetto for the inputs.


herein attached the screenshot of the result.  :)