Search the Community

Showing results for tags 'conversion'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH


  • Community Calendar




Website URL








Found 2 results

  1. I recently used PHP's json_encode( ) function to covert an array created with PHP into a JSON encoded object, as the conversion appeared normal, I then assigned the value to a Javascript variable using PHP's echo construct and reproduced it with a JS alert. This too, appeared normal. My difficulty arose when I tried using the jQuery .map( ) method to convert my nested Javascript object into a nested Javascript array. I received the following error message in my Console: TypeError: e is not an Object. (evaluating 't-1 in e') Am I being foolish to believe that I need a nested array when I already have a nested object? If not, is there not a routine to perform this very conversion?
  2. I am working in xslt 1.0, and cannot use extensions & am limited as to what namespaces can be used (currently only can be used). Another limitation I am working with is the 3rd party application I am using will not properly process includes or imports into the XSL. In other words - the xslt that I need to use must be pretty much self-inclusive, in that whatever is called or referenced must be in the xslt itself & nowhere else. I had decided to try to do a conversion to Julian date & mimic how Excel might do the conversion. I've got the date part figured out, but the hour part is what I'm having trouble with. The example I am using is:Start Time = 08:19:37End Time = 15:58:33 which is a duration/difference of 7:38:56 (BTW, this is only for same-day calculation - I have it to throw an error if Endtime < Start Time or if the Day is > 0). To arrive at the time, I convert everything to seconds & then do the math.08:19:37 converts to 29977 (8 * 3600 for hours + 19 * 60 for minutes + seconds).15:58:33 converts to 57513 (15 * 3600 for hours + 58 *60 for minutes + seconds). The difference is 27536 seconds. I get:27536/3600 =7.6488888888888888888 <-- the integer part is hoursthen the difference of 27536 - 25200 = 2336 <-- the 25200 = 7 hours * 3600 seconds2336/60 = 38.93333333333333333 <-- the integer part is 38 minutesthen the difference of 2336 - 2280 = 56 seconds from above. However, if I try to grab the integer portion of these numbers, its subject to rounding. <xsl:template name="time-difference"> <xsl:param name="from-hour"/> <xsl:param name="from-minute"/> <xsl:param name="from-second"/> <xsl:param name="to-hour"/> <xsl:param name="to-minute"/> <xsl:param name="to-second"/><xsl:variable name="f-secs" select="($from-hour * 3600) + ($from-minute * 60) + ($from-second)"/><xsl:variable name="t-secs" select="($to-hour * 3600) + ($to-minute * 60) + ($to-second)"/><xsl:variable name="sec-diff" select="$t-secs - $f-secs"/><xsl:variable name="daysec-diff" select="format-number(($sec-diff div 86400),'#')"/><xsl:variable name="q" select="($sec-diff div 3600)"/><xsl:variable name="t-hrs-diff" select="format-number(($sec-diff div 3600),'00')"/>.......</xsl:template> The variable q above has 7.648888888888888888 (which is correct)however, the t-hrs-diff once the format-number happens now has "08" in it, making my time incorrect. I know any other formatting attempt to grab the integer portion of the number would result in rounding. Outside of the substring-before & substring-after - which would (I think) make me have to convert the result to a number before using in the next calculation - is there ANY other way to grab the unaltered integer portion of the number & not have to do conversion from a string to number to use the pieces? Is there a better way to do this, given the limitations I have? I would appreciate any thoughts or suggestions. Thanks!