Tags time
Moderator: Mattk
Tags time
Hello everyone, I am creating tables with extreme weather daily, monthly, yearly. I'm having trouble with the tag of the date and time, for example wanted to create a cell with the daily maximum temperature and the time that has occurred, the tag for the hour that I have found is: [day1_th0_tempmax_time] but it is in the format year-month -day-hour-minute-second, and it is really horrible as the format, I'd only need to have the hour and minute. Can anyone help me? thanks
Re: Tags time
You can cut out certain positions from the string. Manual explains how.
Re: Tags time
Hello admin, I read the manual before writing this post, but I could not figure out how to get only the time and date of the minutes that I need. Besides, the manual is in English or German and I'm not in any of the two mother tongues. Could you help me to write the correct tag? Thank you.
Re: Tags time
At least I could tell that page explains it? Surely I have not seen or have not figured out how to do, thank you.
Re: Tags time
page 72 almost at the bottommakoto wrote:At least I could tell that page explains it? Surely I have not seen or have not figured out how to do, thank you.
If you use PHP you could also convert that string into an unix-Time integer and use the date(string,integer) function (this page in PHP manual) to format the output as you want it."#" allows to specify a sub string. Assume that variable "actual_thb0_fc_text" contains "Mostly_clear_and_cooler.". With "[actual_thb0_fc_text#CE]" a substring starting at position 3 (C is the third character in the alphabet) and ending at position 5 (E is the fifth character in the alphabet) is returned: "tua". A blank as position marker would point to the beginning resp. ending of the string. "#" can be combined with other control characters. Example: "[actual_thb0_fc_text@4#AD:none]" returns the first 4 letters of the fourth word in the sentence: "cool" (or "none" if there is the selected string is empty for any reason).
Succes, Wim
Re: Tags time
If you want to use PHP this is the function I use:makoto wrote:At least I could tell that page explains it? Surely I have not seen or have not figured out how to do, thank you.
Code: Select all
<?php
# example converting MH date time fields to desired format using PHP
#
# add this function to your scripts
#
function string_date ($input, $text) {
$unixDate = strtotime(substr($input,0,8).'T'.substr($input,8,6)); // converts MH YYYMMDDHHMMSS to integer
$string = date($text,$unixDate);
return $string;
}
#
# how to use
#
$timeFromMH = '20130912065601'; // example, should be your input
$timeOnlyFormat = 'H:i'; // the desired date or time string
#
echo string_date ($timeFromMH, $timeOnlyFormat)
#
?>
Re: Tags time
Hello win, thanks for the reply, I am creating an html page to be inserted into a frame in the page. Use only tags that generates the Meteohub as you can see from the code attached. The result is this test page http://www.meteopiova.altervista.org/pr ... stremi.php
Thank you so much if you can help me.
Thank you so much if you can help me.
Code: Select all
</table>
<p> </p>
<table style="width: 100%" cellspacing="10" class="style13">
<tr>
<td class="style10" style="width: 48%"><strong>Estremi del<span class="style12"> [actual_date0_puredate_local]</span> alle ore
<span class="style12">[actual_date0_time_local]</span></strong></td>
<td class="style8" style="width: 48%"><strong><span class="style16">Estremi mensili in corso</span></strong></td>
</tr>
<tr>
<td style="width: 48%" class="style14"><strong>Temperatura max
<span class="style15">[day1_th0_tempmax_c]°</span> C alle ore
<span class="style12">[day1_th0_tempmax_time]</span></strong></td>
<td style="width: 48%" class="style9"><span class="style18"><strong>Temperatura max
</strong></span><strong><span class="style19">[month1_th0_tempmax_c]°</span></strong>
<span class="style18"><strong>C il </strong></span><span class="style17"><strong>[month1_th0_tempmax_time]</strong></span></td>
</tr>
<tr>
<td style="width: 48%" class="style26"><span class="style18"><strong>Temperatura min
</strong></span> <strong>
<span class="style27">[day1_th0_tempmin_c]° </span>
<span class="style18">C alle ore
</span>
<span class="style17">[day1_th0_tempmin_time]</span></strong></td>
<td style="width: 48%" class="style9"><span class="style18"><strong>Temperatura min<span class="style28">
</span></strong></span> <strong>
<span class="style27">[month1_th0_tempmin_c]° </span></strong>
<span class="style18"><strong>C</strong></span><strong><span class="style24">
</span><span class="style18">il</span></strong><span class="style20"><strong><span class="style18">
</span>
<span class="style17">[month1_th0_tempmin_time]</span></strong></td>
</tr>
<tr>
<td style="width: 48%" class="style21"><strong>Temperatura max
percepita<span class="style15"> [day1_th0_heatindexmax_c]°</span> C alle ore<span class="style12"> [day1_th0_heatindexmax_time]</span></strong></td>
<td style="width: 48%" class="style21"><strong>Temperatura max percepita <span class="style15"> [month1_th0_heatindexmax_c]° </span>
C alle ore<span class="style15"> <span class="style12"> [month1_th0_heatindexmax_time]</span></span></strong></td>
</tr>
<tr>
<td style="width: 48%" class="style21"><strong>Temperatura min percepita
<span class="style28">[day1_wind0_chillmin_c]°</span> C alle ore
<span class="style12">[day1_wind0_chillmin_time]</span></strong></td>
<td style="width: 48%" class="style21"><strong>Temperatura min percepita
<span class="style28">[day1_wind0_chillmin_c]° </span> C alle ore<span class="style28">
<span class="style12">[day1_wind0_chillmin_time]</span></span></strong></td>
</tr>
Re: Tags time
Instead of complete date time fieldmakoto wrote:Hello win, thanks for the reply, I am creating an html page to be inserted into a frame in the page. Use only tags that generates the Meteohub as you can see from the code attached. The result is this test page http://www.meteopiova.altervista.org/pr ... stremi.php
Thank you so much if you can help me.
Code: Select all
[day1_th0_tempmax_time]
Code: Select all
[day1_th0_tempmax_time#IJ]:[day1_th0_tempmax_time#KL]
position I=9 and J=10 (=hour)
a semicolon (:)
position K=11 and L=12 (= minutes)
Succes, Wim
Re: Tags time
Thank you so much Wim , where I found the variable that you write..... #IJ and other in the manual of meteohub?
Re: Tags time
Wim Hello, thanks for the help, how do I isolate even date with the commands you told me before? Where can I find a table with the variables I've written? Thank you very much.
Re: Tags time
Thank you win, problem resolving...... understand how create it.... thank you so much!