Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006

    Question Unanswered: taking date from user

    hi i am taking date from user.

    if i want to take only date or only time from user and save into database than what to do?

    i am using MS SQL Server which takes datatype as 'datetime' which takes both date and time as value to store in database.

  2. #2
    Join Date
    Nov 2003
    Times are tricky for input because you have to control the format so much, but I usually use the format parameter of the convert function.

    --for time:
    select convert(varchar(24),getdate(),108)
    --for date:
    select convert(varchar(24),getdate(),103)
    Look up BOL for "CAST and CONVERT".
    Last edited by onansalad; 02-03-06 at 10:51.
    Kit Lemmonds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts