Comments on: JQuery for Everyone: Replacing [Today] http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/ Follow me on Twitter: @eusp Tue, 22 Sep 2009 05:06:31 -0700 http://wordpress.org/?v=2.8.4 hourly 1 By: Carlos http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/comment-page-1/#comment-15006 Carlos Mon, 20 Jul 2009 14:35:58 +0000 http://www.endusersharepoint.com/?p=1221#comment-15006 HEllo EVERYONE. I just copy the code, change the search column and the code is almost working fine, but the count it's made is not correctly. I use a column that has the following: "18/07/2009 18:16" and it should show the difference between this date and the now time, that is 20/07/2009 11:34" but it is showing just 17 hrs, 16 min. It should be 1 day 17 hrs, 16 min. What is wrong? thanks HEllo EVERYONE.
I just copy the code, change the search column and the code is almost working fine, but the count it’s made is not correctly.
I use a column that has the following: “18/07/2009 18:16″ and it should show the difference between this date and the now time, that is 20/07/2009 11:34″ but it is showing just 17 hrs, 16 min. It should be 1 day 17 hrs, 16 min. What is wrong? thanks

]]>
By: Christophe http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/comment-page-1/#comment-13387 Christophe Thu, 04 Jun 2009 02:50:37 +0000 http://www.endusersharepoint.com/?p=1221#comment-13387 Marc, this is "by design" as JavaScript will run on your PC. If you need the same time reference for everybody, you'd better pick the current time on the server side. You could for example use a Data View Web Part and xsl timestamp functions for that. Marc, this is “by design” as JavaScript will run on your PC.
If you need the same time reference for everybody, you’d better pick the current time on the server side. You could for example use a Data View Web Part and xsl timestamp functions for that.

]]>
By: AutoSponge http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/comment-page-1/#comment-13385 AutoSponge Thu, 04 Jun 2009 00:22:16 +0000 http://www.endusersharepoint.com/?p=1221#comment-13385 Marc, You have to adjust both the client's time and the server's representation to GMT. For the client, try this: <pre> var today = new Date(); var clOff = today.getTimezoneOffset(); today = Date.parse(today)/1000; today = today-clOff; </pre> Then for the server (hard-coded to the server's timezone), try: <pre> var d1 = Date.parse($(e).text())/1000; var svrOff = 6*60; //GMT offset in minutes d1 = d1-svrOff; </pre> Marc,

You have to adjust both the client’s time and the server’s representation to GMT. For the client, try this:

var today = new Date();
var clOff = today.getTimezoneOffset();
today = Date.parse(today)/1000;
today = today-clOff;

Then for the server (hard-coded to the server’s timezone), try:

var d1 = Date.parse($(e).text())/1000;
var svrOff = 6*60; //GMT offset in minutes
d1 = d1-svrOff;
]]>
By: Marc http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/comment-page-1/#comment-13361 Marc Wed, 03 Jun 2009 12:33:25 +0000 http://www.endusersharepoint.com/?p=1221#comment-13361 Hi Paul, thanks for sharing this script. It works great if you are in the same time zone as where the SharePoint server is located. I want to use this to determine the age of a document since it was created. This script compares the created date of the SharePoint doc (American time in my case) to my local PC time (Central European time). So as a default age I get 6 hours. Somebody in Singapore will even get a higher number. If I change my PC to the same time zone as the SharePoint server then it shows the correct age. Is there a way to compare the server time instead of the local pc time? Many thanks, Marc Hi Paul, thanks for sharing this script. It works great if you are in the same time zone as where the SharePoint server is located. I want to use this to determine the age of a document since it was created.

This script compares the created date of the SharePoint doc (American time in my case) to my local PC time (Central European time). So as a default age I get 6 hours. Somebody in Singapore will even get a higher number. If I change my PC to the same time zone as the SharePoint server then it shows the correct age. Is there a way to compare the server time instead of the local pc time?

Many thanks,

Marc

]]>
By: Christophe http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/comment-page-1/#comment-12401 Christophe Fri, 01 May 2009 00:32:32 +0000 http://www.endusersharepoint.com/?p=1221#comment-12401 Kat: many bloggers published the trick you are talking about, and it just doesn't work. More details here: http://pathtosharepoint.wordpress.com/2008/08/14/calculated-columns-the-useless-today-trick/ Kat: many bloggers published the trick you are talking about, and it just doesn’t work.
More details here:
http://pathtosharepoint.wordpress.com/2008/08/14/calculated-columns-the-useless-today-trick/

]]>
By: Kat http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/comment-page-1/#comment-12394 Kat Thu, 30 Apr 2009 20:13:35 +0000 http://www.endusersharepoint.com/?p=1221#comment-12394 I can't recall who blogged about this originally, but there is a quick workaround for using [today] in a calculated column. Simply create a column in your list, and call it "Today". Then set your calculated column up and use [today] the way you really want to. Once you have everything else set up and finalized, you can delete your "Today" column. Voila! The calculated column (so long as you don't go back in to edit it) now works and is referencing the real "today". It's a nice trick for anyone who wants to do this quickly and who doesn't plan to often/ever change any settings for that particular calculated column. Sorry I can't remember the name of the blogger who suggested this originally. I didn't create this workaround- I just use it all the time. I can’t recall who blogged about this originally, but there is a quick workaround for using [today] in a calculated column. Simply create a column in your list, and call it “Today”. Then set your calculated column up and use [today] the way you really want to. Once you have everything else set up and finalized, you can delete your “Today” column. Voila! The calculated column (so long as you don’t go back in to edit it) now works and is referencing the real “today”. It’s a nice trick for anyone who wants to do this quickly and who doesn’t plan to often/ever change any settings for that particular calculated column.

Sorry I can’t remember the name of the blogger who suggested this originally. I didn’t create this workaround- I just use it all the time.

]]>
By: Lance http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/comment-page-1/#comment-11410 Lance Wed, 18 Mar 2009 17:29:11 +0000 http://www.endusersharepoint.com/?p=1221#comment-11410 What if I want to apply this to a Data View Web Part on the page? I have tried giving my DVWP a table ID and then changing table.ms-listviewtable to #nameoftable but this then seems to only change the first column item in the table. Any thoughts on how to do this? What if I want to apply this to a Data View Web Part on the page? I have tried giving my DVWP a table ID and then changing table.ms-listviewtable to #nameoftable but this then seems to only change the first column item in the table.

Any thoughts on how to do this?

]]>
By: AutoSponge http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/comment-page-1/#comment-10534 AutoSponge Wed, 18 Feb 2009 00:19:37 +0000 http://www.endusersharepoint.com/?p=1221#comment-10534 @Jorgen, You asked some great questions. I have no idea what Norwegian looks like to my code, but here are some ideas for troubleshooting: 1. NaN means 'not a number' so chances are the script found a column with character data or a date format it did not recognize. First check that whatever you set "var str" to is the LAST column (left-to-right) with those exact words. For instance if you have var str = 'Modified'; then the columns Modified and Modified By, Modified By will try to apply the script. 2. I use Date.parse($(e).text()) to turn a formatted date into an epoch date. If the local date format is not recognized by JavaScript, you may need to add a custom function to parse the date. @Jorgen,

You asked some great questions. I have no idea what Norwegian looks like to my code, but here are some ideas for troubleshooting:

1. NaN means ‘not a number’ so chances are the script found a column with character data or a date format it did not recognize. First check that whatever you set “var str” to is the LAST column (left-to-right) with those exact words. For instance if you have var str = ‘Modified’; then the columns Modified and Modified By, Modified By will try to apply the script.

2. I use Date.parse($(e).text()) to turn a formatted date into an epoch date. If the local date format is not recognized by JavaScript, you may need to add a custom function to parse the date.

]]>
By: Jorgen http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/comment-page-1/#comment-10524 Jorgen Tue, 17 Feb 2009 21:00:26 +0000 http://www.endusersharepoint.com/?p=1221#comment-10524 Hi Paul, Regarding this code, I've got the same problem as Iain - NaN min occurs in the "last updated" col. Will the language of the installation have any impact on this code (my SP installation is in Norwegian) or date/time formatting? PS: I've tried out some of your jQuery snippets, and I really like them! I find the EUSP site perfect for my non-excisting programming level (working hard for SP super star level)! Hi Paul,

Regarding this code, I’ve got the same problem as Iain – NaN min occurs in the “last updated” col. Will the language of the installation have any impact on this code (my SP installation is in Norwegian) or date/time formatting?

PS: I’ve tried out some of your jQuery snippets, and I really like them! I find the EUSP site perfect for my non-excisting programming level (working hard for SP super star level)!

]]>
By: Brad http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/comment-page-1/#comment-10427 Brad Fri, 13 Feb 2009 19:01:12 +0000 http://www.endusersharepoint.com/?p=1221#comment-10427 Hey thanks. I found something that helps me out a little more then this hack. http://www.sharepointblogs.com/dez/archive/2008/07/31/dynamically-updating-a-sharepoint-calculated-column-containing-a-quot-today-quot-reference.aspx I just compiled the Source and run the scheduled task nightly. It uses a external XML file that you can set up and assign to a task list of your needs. Just set up the -Today- Function like the typical hacking way and use this to keep it going nightly. I enjoyed this code, but I needed something that helps the client out using the basic sharepoint commands so they don't need to come back to me every 5 minutes and ask " how do you do -this- with the code setup on the sharepoint site." I appreciate your time and energy, but as they say if there is a "WILL" there is a "WAY" :] @wanda It seems you are trying to do something like I am, just not wording it the same way. This might help you out in the way you are seeking. P.S.To All: If you don't have a copy of Visual Studio I will be more than happy to email or post the code in a zip (Compiled and non-compiled) so you can plug it into your site. Thanks, - Brad Hey thanks. I found something that helps me out a little more then this hack.

http://www.sharepointblogs.com/dez/archive/2008/07/31/dynamically-updating-a-sharepoint-calculated-column-containing-a-quot-today-quot-reference.aspx

I just compiled the Source and run the scheduled task nightly. It uses a external XML file that you can set up and assign to a task list of your needs.

Just set up the -Today- Function like the typical hacking way and use this to keep it going nightly.

I enjoyed this code, but I needed something that helps the client out using the basic sharepoint commands so they don’t need to come back to me every 5 minutes and ask ” how do you do -this- with the code setup on the sharepoint site.”

I appreciate your time and energy, but as they say if there is a “WILL” there is a “WAY” :]

@wanda
It seems you are trying to do something like I am, just not wording it the same way. This might help you out in the way you are seeking.

P.S.To All: If you don’t have a copy of Visual Studio I will be more than happy to email or post the code in a zip (Compiled and non-compiled) so you can plug it into your site.

Thanks,
- Brad

]]>