cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

How can we take only date input from date time picker widget?

cchhetri
8-Gravel

How can we take only date input from date time picker widget?

I need to enter date through date time picker , but with restriction that time stamp should not be captured.If anyone have come across

such requirement,please let me know the solution.

3 REPLIES 3

What does it means that timestamp shouldn't be captured? ( Hour:Minute:Second? )

Yeah, basically when i select only date through date-time Picker widget , even than default time gets saved in my data table.Is there a way where only date is saved in the data table.

DateTime fields on TW always are Timestamp based ( milliseconds ) then always will have time information in it. Here you have some options:

  1. Record Only Date as String ( which I won't recommend )
  2. Record Only Date as DateTime with a "policy", for instance you can record all only Date timestamps with Hour = 0, Minute = 0, Second=0 and Millisecond =0, or as we record ( Hour=23, Minute=59, Second=59 and Millisecond=999 ).

For option 2 you can do it with an Expression widget with DateTime input from DateTime Picker and DateTime output, inside you can reset time parts with Javascript expression: (new Date(input.getFullYear(),input.getMonth(),input.getDate(),0,0,0,0))

Hope it helps.

Announcements


Top Tags