Skip to main content
1-Visitor
August 5, 2017
Question

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

  • August 5, 2017
  • 1 reply
  • 2760 views

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.

    1 reply

    1-Visitor
    August 7, 2017

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

    cchhetri1-VisitorAuthor
    1-Visitor
    August 7, 2017

    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.

    1-Visitor
    August 7, 2017

    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.