locked
Sharepoint date calculations = WRONG RRS feed

  • Question

  • Can someone show me how to create a calculated column that displays the date only? I'm using the microsoft absence planner.

    I am simply trying to display a date without the time. I'm getting inconsistent results. Someone suggested that I simply add a day but that is not consistent.

    I created a calcualted column to show me the day that Sharepoint thinks the time value has. The results are disappointing to say the least

    someone suggested this formula since it seems to be always off by a day:
    StartDate is a calculated column = =DATE(YEAR([Start Time]),MONTH([Start Time]),DAY([Start Time]+1))
    *sometimes this formula displays the right info, sometimes not

    The last column is just = Day_[Start Time] so I can try and figure out what is going on :(
    Attendance item      System Account      Other      6/28/2010 12:00 AM      6/29/2010      28
    Attendance item      System Account      Jury Duty      9/29/2009 12:00 AM      9/30/2009      29
    Attendance item      System Account      Jury Duty      9/29/2009 12:00 AM      9/30/2009      29
    Attendance item      System Account      Jury Duty      9/30/2009 12:00 AM      9/30/2009      29
    Attendance item      System Account      Jury Duty      9/30/2009 12:00 AM      9/1/2009      30
    Attendance item      System Account      Other      4/30/2010 12:00 AM      4/1/2010      30
    Attendance item      System Account      Other      4/30/2010 12:00 AM      4/1/2010      30
    Attendance item      System Account      Other      3/31/2010 12:00 AM      3/1/2010      31
    Attendance item      System Account      Other      3/31/2010 12:00 AM      3/1/2010      31

    Sunday, September 12, 2010 4:36 PM

Answers

  • try this for you calculated field formula

    =TEXT(WEEKDAY(StartDate), "dddd")

    vr,
    SharePointNinja

    Monday, September 13, 2010 5:20 AM

All replies

  • I already had this problem... (not in a calculated field but a date field wich have date only selected in column definition)

    I had a custom form to create items and i put date object in field when saving item (that doesnt seem to store the data correctly and sometime the day is not the good one).

    To resolve my problem i had to store

     item("DateFieldName") = String.Format("{0}z", Date.Parse(myDateString).ToString("s")
    

    instead of directly store

    item("DateFieldName") = Date.Parse(myDateString)
    Maybe it something like that... i mean related to date format...
    Sunday, September 12, 2010 8:15 PM
  • This may sound like a silly question, but are you sure that the regional settings on your SPWeb are correct?  Make sure that whoever created the site collection put the correct regional settings for timezone in.  Most of the time this is inherited from the site collection, which should inherit from the server's regional settings, however, I have seen some instances where the Regional settings were Pacific Standard time, which is not the correct timezone for my region.  Just make sure that your regional settings are correct.  If they are correct, are you doing anything with your code to ensure that it is storing as the correct regional timezone.
    Monday, September 13, 2010 2:57 AM
  • try this for you calculated field formula

    =TEXT(WEEKDAY(StartDate), "dddd")

    vr,
    SharePointNinja

    Monday, September 13, 2010 5:20 AM