none
Calculated date field displays differently in List View and Data View web parts

    Întrebare

  • In SharePoint GUI I created a simple custom list with a calculated Date/Time field (Due).  The calculation is =[Created]+7.  I'm trying to display this data on a page using a DVWP.  But first, for testing purposes, I also created a second calculated Date/Time (TestCreate) field in my custom list that is simply =[Created].

    In the List View from within SharePoint, the dates show as expected (for example):
    Created = 8/12/2010 3:45 PM
    Due = 8/19/2010 3:45 PM
    TestCreate = 8/12/2010 3:45 PM

    In SharePoint Designer, I added a Data View web part and the above three data elements (each configured to display mm/dd/yyyy hh:mm:ss tt).  I see the time displayed for the example list item as:
    Created = 8/12/2010 3:45:30 PM
    Due = 8/19/2010 10:45:00 AM
    TestCreate = 8/12/2010 10:45:00 AM

    I've tested a couple scenarios and the calculated fields always display five hours in the past (along with dropping the seconds).  It seems like the DVWP is returning the date in a different time zone (with no seconds).  The lcid is set right (1033).  I didn't see any time zone settings for the DVWP specifically.  I'm basically stuck.  Could someone help me figure this one out.

    Thanks.

    12 august 2010 00:42

Toate mesajele

  • Hi,

     

    I have tested what you have said, but unfortunately I can’t reproduce your issue.

    In my local it worked well as expected behavior.

     

    What’s your version of SharePoint? My test Server is 12.0.0.6535.

     

    Hope this helps

     

    Thanks!

    Stanfford

    17 august 2010 03:27
  • We're on 12.0.0.6318.  The admin has not upgraded to SP2 yet.  Not sure if that would/could make a difference or not.  I've replicated this on both test and prod (same version).

    Edit: I got access to the Dev server, which is now running 12.0.0.6421.  I was able to replicate the problem here as well.  The difference in the calculated time is 7:00:xx behind the Create date/time, while I originally reported five hours.  I checked on prod and test and it is actually seven hours off.

    17 august 2010 15:45
  • All date value is displayed based on Time Zone of the site.

    you can have a look:  Site Settings-->Regional Settings.

    so there is a time zone only.

     

     

     

     

    18 august 2010 03:05
  • I checked that and both the site and my own regional settings are set correctly to Pacific Time (GMT-8).  This is a small single farm, two server configuration with all sites/users located in the Pacific Time zone.  The server OS time is set correctly. 

    In the course of investigating this problem yesterday, we did discover that the time set in the regional settings page in the Central Admin site (not accessible via GUI, but accessible by using _layouts/regionalsetng.aspx URL) was set to Mountain time zone.  So at least we can fix that issue. 

    But I'm still at a loss as to why a calculated date value would display one time in List View and a different time in a DVWP, even though it's the exact same date field.  Anyone out there experience this?  I can easily replicate this on all three of our systems (dev, test and prod).

    18 august 2010 14:49
  • Anyone???  Given that this is easy to replicate on three separate environments here, I can't believe I'm the only one that has run across this.  It makes the Data View Web Part difficult to use if your List/Library is using a calculated data field.  Seems kind of ridiculous that I need to manually add seven hours to each DVWP calculated date field that I want to display.

    Any suggestions or recommendations are welcome.  I would really like to get this problem resolved.  Thanks.

    30 august 2010 18:02
  • Hello,

    Did anyone ever find an answer to this issue?  I am also having this problem on a dataview webpart. My field calculations appear to be working correctly, when displayed in a list view. However, when I use the list data in a dataview webpart for setting conditional formats, based on the calculated date values, the dates appear different than the date in the list, by a couple of hours. 

    Point to note, I'm also running 12.0.0.6421.

    Thanks.


    • Editat de kwengiel 24 februarie 2012 18:22
    24 februarie 2012 18:04