Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
How do i get te current server date in XSLT.
I tried:
<xsl:value-of select="umbraco.library:FormatDateTime(Exslt.ExsltDatesAndTimes:date(), 'dd/mm/yy')" />
But it returns 30/11/2010 and not 05/12/2010 as i would expect. Any good ideas? Thanks!Brian
Hi Brian,
You can use the following to get the current date
umbraco.library:CurrentDate()
Rich
i Rich
Ok, tanks alot. I keep getting weird dates though but it must be some other part of this jquery picker i'm working with. This:
<xsl:value-of select="umbraco.library:FormatDateTime(umbraco.library:CurrentDate(), 'mm/dd/yy')" />
Returns random dates. Now it says: 19/11/2010/Brian
umbraco.library:FormatDateTime()
Works fine. The error is here:
I think that the extension is using the time on the server so maybe it's because it's date is out of sync you are getting the wrong date?
/Jan
I get the right time when i output umbraco.library:CurrentDate():
2010-12-05T20:30:27
I am using the xslt inside this:<xsl:value-of select="umbraco.library:AddJquery()"/>
<script type="text/javascript">
That may be the problem I am not sure yet. The reason my initial code was changing was because i used minutes -> "dd/mm/yy" /Brian
Hi Brian
It seems like some of the code you're trying to paste is missing? I can't see the full <script> code?
Here is the code if you wan't a look:
<xsl:template match="/"> <xsl:value-of select="umbraco.library:AddJquery()"/> <script type="text/javascript"> $(function () { $('#check').bind('click', function () { var arr = $('#arriving').val(); var arrUrl = arr.split("/"); var UrlArrDone = arrUrl[1] + '.' + arrUrl[0] + '.' + arrUrl[2]; var dep = $('#departing').val(); var depUrl = dep.split("/"); var UrldepDone = depUrl[1] + '.' + depUrl[0] + '.' + depUrl[2]; window.open("<xsl:value-of select="$currentPage/bookingUrl" disable-output-escaping="yes" />" + "<xsl:text disable-output-escaping="yes">&depart=</xsl:text>" + UrldepDone + "<xsl:text disable-output-escaping="yes">&arrive=</xsl:text>" + UrlArrDone + "<xsl:text disable-output-escaping="yes">&adult=</xsl:text>" + $('#adults').val() + "<xsl:text disable-output-escaping="yes">&child=</xsl:text>" + $('#children').val() + "<xsl:text disable-output-escaping="yes">&promo=</xsl:text>" + $('#promocode').val() + "<xsl:text disable-output-escaping="yes">&rooms=</xsl:text>" + $('#rooms').val() ); return false; }); }); $(function () { // Datepicker $(function () { $("#arriving").datepicker( { dateFormat: 'dd/mm/yy', altField: '#arrival', altFormat: 'yy/mm/dd', onSelect: function (dateText, inst) { } } ); $("#arriving").datepicker('setDate', '<xsl:value-of select="umbraco.library:FormatDateTime(umbraco.library:CurrentDate(), 'dd/MM/yyyy')" />'); inline: true }); $(function () { $("#departing").datepicker( { dateFormat: 'dd/mm/yy', altField: '#departure', altFormat: 'yy/mm/dd' } ); $("#departing").datepicker('setDate', '<xsl:value-of select="umbraco.library:FormatDateTime(umbraco.library:CurrentDate(), 'dd/MM/yyyy')" />'); inline: true }); }); </script> </xsl:template>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting the current date
How do i get te current server date in XSLT.
I tried:
But it returns 30/11/2010 and not 05/12/2010 as i would expect. Any good ideas?
Thanks!
Brian
Hi Brian,
You can use the following to get the current date
Rich
i Rich
Ok, tanks alot. I keep getting weird dates though but it must be some other part of this jquery picker i'm working with. This:
Returns random dates. Now it says: 19/11/2010
/Brian
umbraco.library:FormatDateTime()
Works fine. The error is here:
umbraco.library:FormatDateTime()
I think that the extension is using the time on the server so maybe it's because it's date is out of sync you are getting the wrong date?
/Jan
I get the right time when i output umbraco.library:CurrentDate():
2010-12-05T20:30:27
I am using the xslt inside this:
<xsl:value-of select="umbraco.library:AddJquery()"/>
<script type="text/javascript">
That may be the problem I am not sure yet. The reason my initial code was changing was because i used minutes -> "dd/mm/yy" /Brian
Hi Brian
It seems like some of the code you're trying to paste is missing? I can't see the full <script> code?
/Jan
Here is the code if you wan't a look:
is working on a reply...