locked
sharepoint list field - how do you initialize with a current timestamp? RRS feed

  • Question

  • In a sharepoint 2007 list,

    Is there a way to initialize a field with the current timestamp?

    I've tried setting the datetime field to Today, and it just fills in the date not the time.

    I've tried to use a calculated field but i'm running into formula problems.

    Thanks


    Peter schenk

    Tuesday, May 15, 2012 2:31 PM

Answers

  • Create yourself a column called "Time" and make it a "Calculated (based on other columns)" in your formula add,

    =TEXT([Modified],"hh:mm:ss")
    If you want to base it on the last modified time, otherwise you can replace with [Created] and drop the :ss if you don't want the seconds included.


    Paul Turner http://redmanta.co.uk/blog Twitter: @RedMantaUK MCTS:WSS,MOSS,2010 MCITP:2010.
    Please remember to click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if it was useful.

    • Marked as answer by pete2059 Thursday, May 17, 2012 1:59 PM
    Thursday, May 17, 2012 1:55 PM

All replies

  • Hi,

    You can use Date and Time field here. 

    Under the default option select Todays date and in Date and Time format select date and time.

    I hope this will help you out.


    Thanks, Rahul Rashu

    Wednesday, May 16, 2012 3:30 AM
  • Thanks Rashu, Rahul.

    but when I did that I get the current date, but the time part of the timestamp is not filled in.

    I found a work around using the modified field, but would like to know if there is a better way.


    Peter schenk

    Wednesday, May 16, 2012 12:25 PM
  • Hi pete2059,

    You can achieve it by the following screenshot.

     

    Thanks,

    Jack

    Thursday, May 17, 2012 9:13 AM
    Moderator
  • Thanks Jack, 

    That works great on a date field and will populate the date part of a timestamp correctly, but the time portion of a timestamp is set to midnight (all zeros). Is there a way to get a current timestamp that will get not only the current date but the current time as well?

    thanks


    Peter schenk

    Thursday, May 17, 2012 12:53 PM
  • Create yourself a column called "Time" and make it a "Calculated (based on other columns)" in your formula add,

    =TEXT([Modified],"hh:mm:ss")
    If you want to base it on the last modified time, otherwise you can replace with [Created] and drop the :ss if you don't want the seconds included.


    Paul Turner http://redmanta.co.uk/blog Twitter: @RedMantaUK MCTS:WSS,MOSS,2010 MCITP:2010.
    Please remember to click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if it was useful.

    • Marked as answer by pete2059 Thursday, May 17, 2012 1:59 PM
    Thursday, May 17, 2012 1:55 PM
  • Thanks Paul, That works

    Peter schenk

    Thursday, May 17, 2012 2:00 PM
  • Hey Paul, this works for me too. However, do you know how to display the time with AM/PM instead of 24 hour time? I've been searching for this answer but cannot find it. Thanks in advance for any help you can offer.
    Thursday, July 12, 2012 12:26 PM
  • I found that feature Meilton in the sharepoint regional settings for the page. I would suppose but can't test that if you made the entries used on the code they gave you that it will pull based on the format in the regional settings. 

    I appreciate you guys input here...as I have been trying to use the "RIGHT NOW" date timestamp for logbook settings and can't wait to try this at work on our sharepoint page.

    Sunday, February 2, 2014 11:34 PM
  • here is the link for a video showing this feature Meilton

    http://sharepoint-tutorial.net/post/2013/07/24/change-regional-settings-of-a-sharepoint-site.aspx

    Sunday, February 2, 2014 11:37 PM