CaptNemo Posted August 16 Report Share Posted August 16 How can I make the dates submitted on my table 2 digits using the formula field? Here is a screenshot of the result I wanted. Quote Link to comment Share on other sites More sharing options...
0 CoopperBackpack Posted August 17 Report Share Posted August 17 Hello @CaptNemo, As far as I understood you want to add a leading zero to the numbers less than 10. If so, please test these formulas: - Hours RIGHT('0' + CAST((DatePart(hour, [@field:Date_field])) as nvarchar), 2) - Minutes RIGHT('0' + CAST((DatePart(minute, [@field:Date_field])) as nvarchar), 2) Where [@field:Date_field] should be replaced with your field name. Quote Link to comment Share on other sites More sharing options...
0 Winskey Posted August 19 Report Share Posted August 19 Hi @CaptNemo, Here is a formula that you may use to add a leading zero to the numbers less than 10: -Hours CASE WHEN DATEPART(hh, [@field:Date_Field]) < 10 THEN '0' + CAST(DATEPART(hh, [@field:Date_Field]) AS VARCHAR) ELSE CAST(DATEPART(hh, [@field:Date_Field]) AS VARCHAR) END -Minutes CASE WHEN DATEPART(n, [@field:Date_Field]) < 10 THEN '0' + CAST(DATEPART(n, [@field:Date_Field]) AS VARCHAR) ELSE CAST(DATEPART(n, [@field:Date_Field]) AS VARCHAR) END Where [@field:Date_field] should be replaced with your field name. Quote Link to comment Share on other sites More sharing options...
Question
CaptNemo
How can I make the dates submitted on my table 2 digits using the formula field? Here is a screenshot of the result I wanted.
Link to comment
Share on other sites
2 answers to this question
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.