Skip to main content
Nintex Community Menu Bar

Hello,

I'm using SP list to generate the SMO and store the data, and I need to store the Due Date within K2 view. 

Since there is 7 hours time difference between the server and me, when I select the date from the control, it always saved as one day earlier with addtional time. For instance, I select "1/6/2017" and the saved result is "1/5/2017 5:00 PM".

 

To test the scenario, I create the test SP list as following:
1.To create the Date1 as "Date and Time", which is the only option in Sharepoint for date, and select "Date Only" as format (SP data column.png).
2.To generate the SMO and views, add the Calendar control on one of the views, until now, I have the 3 options for "Date Type" (K2 add calendar control.png).
3.To set the control field to "Date1" (K2 change field.png).
4.Then I only have one option "DateTime" for "Date Type" (K2 after change field.png).

With these step I can repeat the issue. And if I create the SMO with K2 designer, then I can set "Date" for "Date Type", and the right date will be saved. 

I need to use the sharepoint as portal, and the Due Date as "Date" to send out the reminding email base on it.

 

Anyone has a idea to sovle it? 

Thank you.


16632i8DDAC13773D0547D.png
13096i381867D4B146EFAF.png
11875i6C7E783A8AA96D29.png
14573i089DDE6C5D7E6E92.png

 

Hi,

 

 You can use JQuery or JavaScript  in smartforms to change  DateTime as per required time zone. 

 

 

 var inputDate= new Date();

inputDate.toLocaleString("en-US", {timeZone: "America/New_York"}; 

 

 

 To call JavaScript or JQuery  function please use DataLabel  control and Add script in  Expression  property and check Literal option.


Hello Kran,

 

Thanks.

But  I want to store the date without time info. Add JS code in expression doesn't work for me(it shows as plain text), and I guess it will change the date format on the web page, but not change what it actucally saves.

 

Max


HI MXWang,

 

      Script will change Timezone property of date object, which you can use to show in ur calendar without time,  and while saving to SQL DB this will  store date as per changed timezone hence will not chnage the date when you save on DB

 

 While writing the script  make sure its inside <script> </script> tags, as mentoned below. Also make sure for datalabel where this script is added  under expression, please check the litrel option. else it will appear as plain text.

 

 Example:

<script>

 var inputDate= new Date();

inputDate.toLocaleString("en-US", {timeZone: "America/New_York"}; 

 </script>

 

 

Another way to do this is send date in string format from your form and on smartobject method  before passing to save  method, convert it to Datetime.

 

 


It turns out the Get Sharepoint Timezone rule was deleted by mistake.

 

@Kran, thank you, I know how to trigger the JS code in smarforms now.


Reply