Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8105569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:12:01+00:00 2026-06-06T00:12:01+00:00

In SharePoint 2007, when I saved a document to a document library, the value

  • 0

In SharePoint 2007, when I saved a document to a document library, the value shown in the list view under Modified is:

18/6/2012 13:06

But yet when I programmatically access the field which I assume is SPListItem.File.TimeLastModified, it returned:

18/6/2012 3:06:43 AM

That means the 1 has been truncated, and so whatever that is reading the value turned 1pm into 3am.

The site and the webs are all inheriting the correct time zone. What should I do to make TimeLastModified to display the correct time? Or is this possible at all?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:12:02+00:00Added an answer on June 6, 2026 at 12:12 am

    The TimeLastModified property returns the value always in UTC. Date/time values displayed on SP pages are usually converted to the time zone according to the culture of the current user. It is a good practice to show everything in the user’s time zone but internally save the value in UTC.

    If you want to convert the UTC value to the current user’s time zone and then maybe print it in UI, you can use the following code:

    SPFile file = ...;
    SPWeb web = ...; // SPContext.Current.Web or file.Item.ParentList.ParentWeb or ...
    DateTime time = UTCToWebTime(file.TimeLastModified, web);
    string text = FormatWebTime(time, web);
    
    DateTime UTCToWebTime(DateTime utcTime, SPWeb web) {
        SPTimeZone timeZone = web.RegionalSettings.TimeZone;
        DateTime localTime = timeZone.UTCToLocalTime(utcTime);
        return DateTime.SpecifyKind(localTime, DateTimeKind.Local);
    }
    
    // Uses SPRegionalSettings to be more accurate then value.ToString(web.Locale).
    string FormatWebTime(DateTime value, SPWeb web) {
        SPRegionalSettings regionalSettings = web.RegionalSettings;
        DateOptions dateOptions = new DateOptions(
            regionalSettings.LocaleId.ToString(CultureInfo.InvariantCulture),
            (SPCalendarType) regionalSettings.CalendarType, null,
            regionalSettings.FirstDayOfWeek.ToString(CultureInfo.InvariantCulture),
            regionalSettings.AdjustHijriDays.ToString(CultureInfo.InvariantCulture),
            null, null));
        string timePattern = regionalSettings.Time24 ?
            dateOptions.TimePattern24Hour : dateOptions.TimePattern12Hour;
        DateTimeFormatInfo format = web.Locale.DateTimeFormat;
        return value.ToString(format.ShortDatePattern, format) + " " +
            value.ToString(timePattern, format);
    }
    

    — Ferda

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a SharePoint 2007 deployment which will have a substantially large document library.
Does Sharepoint 2007 usage reporting track programmatic access to items in a document library?
I have created a document library in sharepoint 2007 and i have enabled incoming
I have a SharePoint 2007 custom list that I have saved as a list
I modified the newform.aspx page in Sharepoint 2007 Designer for an announcment list as
We use MOSS 2007, and I have a document library with several document templates
I'm using sharepoint 2007. I have a list called User Tickets with one column
I am using SharePoint 2007 workflows for document approval process. When I terminate a
The call center managers for my company use document libraries in a SharePoint 2007
I've created a list using the SharePoint (MOSS 2007) Issue Tracking List. A Comments

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.