Mylene Posted June 13, 2016 Report Share Posted June 13, 2016 Hi, I need to store date when record was submitted. I know that I can stamp record, using a "time stamp" hidden field, but I need to store only date, month and year. I don't need time, because I'm not able to use this field in grouping data on Chart report. Thanks for help! Quote Link to comment Share on other sites More sharing options...
Mathilda Posted June 13, 2016 Report Share Posted June 13, 2016 Hi Mylene, Try using the following script: <SCRIPT LANGUAGE="JavaScript"> Stamp = new Date(); var v_TimeStamp; v_TimeStamp=('' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+Stamp.getFullYear()); document.getElementById("InsertRecordDate_field").value=v_TimeStamp; </SCRIPT> Please add your field name instead of Date_field. Hope it helps. KenColcreate 1 Quote Link to comment Share on other sites More sharing options...
RuisiHansamu Posted February 15, 2022 Report Share Posted February 15, 2022 Hello there, just an update, here is a helpful forum post that I discovered when I was looking for a solution. This might help you out with your workflow or calculation. Quote Link to comment Share on other sites More sharing options...
Queso Posted February 15, 2022 Report Share Posted February 15, 2022 Hello, I pull up the date from the Timestamp by creating a formula field on a table level and then inserting the following formula: CONVERT(varchar(10), [@field:Timestamp], 101) 101 is a date format I commonly use. Sometimes, I use 110 if I want a dash on it instead of slash. Quote Link to comment Share on other sites More sharing options...
Kurumi Posted July 29, 2022 Report Share Posted July 29, 2022 Hi - I would like to add on this post. In case, you would like to get the month using DATEPART() and add leading zero, you may use these formulas: RIGHT('0' + CAST(DATEPART(month, [@field:DATE]) AS VARCHAR(10)), 2) or RIGHT('0' + CONVERT(VARCHAR(2), DATEPART(MM, [@field:DATE])), 2) Result: January = 1 to 01 February = 2 to 02 Since the DATEPART() function returns an integer, leading zero's will always disappear and need to be manually added like so. Reference:https://www.w3schools.com/sql/func_sqlserver_datepart.asp Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.