Tony K
I imagine the reason you want to do it without the view widget is because
it does not accept a variable as an input?, only tiddlers and fields.
Something I have tried to get fixed because its out only built in date
converter.
- I have one possible solution which needs me to spit the longer
timestamp into separate characters but the split[] operator does not do
this.
- Here is another approach using maths operators, buit needs a little
reworking for your own use.
\define timeonly(timestamp)
<$list filter="[[$timestamp$]length[]]" variable=length>
<$list filter="[<length>match[5]]" variable=nul>
$timestamp$<br>
</$list>
<$list filter="[<length>match[17]]" variable=nul>
{{{ [[$timestamp$]remainder[100000000]divide[1000000]trunc[]]
}}}:{{{ [[$timestamp$]remainder[1000000]divide[10000]trunc[]] }}}<br>
</$list>
</$list>
\end
<$list filter="20200520223405903 23:45 22:21" variable=timestamp>
<$macrocall $name=timeonly timestamp=<<timestamp>>/>
</$list>
Regards
Tony
On Thursday, May 21, 2020 at 2:23:20 PM UTC+10, Tony K wrote:
>
> Hello Tony
>
> Thanks a lot for replying, and I would be highly interested to learn how
> to do it in wikitext and widgets
>
> I tried to explain what I am trying to do in my OP but I will try again.
> Issue is it sounds so clear in my head that I am getting troubles
> explaining it.
>
> Below are 2 entries in the same tiddler of my DailyNotes plugin. The first
> one has the old timestamp (only hours) the second one new timestamp
>
> 22:34~Entry with old time stamp <br />
>
> 20200520223405903~Entry with new time stamp <br />
>
> what I am trying to do is a function setting a variable called timestamp
> to 22:34 no matter if I feed it with 22:34 or 20200520223405903
>
>
> regarding your point
>
>>
>> - Why not make a batch operation to standardise the title in one go?
>>
>> funny you should bring that up, I just wake up after a few hours of
> sleeping thinking about this but, still, I would like to know how to do the
> above for my own education
>
>
> thanks again
>
>
>
>
> On Thursday, May 21, 2020 at 2:58:57 AM UTC+3, TonyM wrote:
>>
>> Tony K,
>>
>> Fine run with your solution with a JS macro since this is clearly your
>> strength,However I am confident with a little more detail to your request,
>> for clarity I can make a pure wikit text and widget solutions for you.
>>
>> On the other hand using the title as a time stamp ie the primary key to a
>> tiddler as an attribute (the time) of the tiddler is in my view not a good
>> design choice. I have a much better one available. Just ask
>>
>> Are you saying some tiddlers are named hhmm and others
>> [UTC]YYYY0MM0DD0hh0mm0ssXXX ? and you want a function to handle them both
>> equally?
>>
>> - We can do that with wikitext and widgets.
>> - Why not make a batch operation to standardise the title in one go?
>> - I would move the time stamp date to a separate field what ever you
>> choose the title to be.
>> - In tiddlywiki the title is both a unique key to its contents and
>> often an aesthetic easy to read title.
>>
>> Regards
>> Tony
>>
>>
>>
>>
>>
>> On Thursday, May 21, 2020 at 6:46:14 AM UTC+10, Tony K wrote:
>>>
>>> Solved, I created a JS macro for it
>>>
>>> thanks
>>>
>>> On Wednesday, May 20, 2020 at 7:54:48 PM UTC+3, Tony K wrote:
>>>>
>>>> is it possible to manipulate a timestamp without the $view?
>>>>
>>>> I have timestamp saved in 2 formats
>>>>
>>>> old format 0hh:0mm and new format <<now "[UTC]YYYY0MM0DD0hh0mm0ssXXX">>
>>>>
>>>> I am trying to make my code backward compatible so what I need is when
>>>> I read the time stamp from the tiddler and display it in both cases as
>>>> 0hh:0mm
>>>>
>>>> I tried to work with length
>>>>
>>>> \define long()
>>>> <$view tiddler=<<timestamp>> field=title format=date template="0hh:0mm"
>>>> />
>>>> \end
>>>>
>>>>
>>>> <$list filter="""[<timestamp>length[]match[9]then<timestamp>else<long>]"""
>>>> variable="type"/>
>>>>
>>>> but in that case it is being evaluated to the full text and not the
>>>> value :|
>>>>
>>>> thanks in advance
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/a9db9070-faf7-4d62-920c-5a052f7df10a%40googlegroups.com.