Date and Time Scenario

Results 1 to 4 of 4

Thread: Date and Time Scenario

  1. #1
    Join Date
    Dec 1969
    Posts
    38

    Default Date and Time Scenario

    Hi,<BR>Here is a situation:<BR>I am working on an application where I take start time and ending time of a task and submit it to a MS SQL database. The Field type MS SQL for these are datetime. But I only submit the time Exp: 10:00 AM. But what it actually stores in the database is Dec 31 1899 10:00:00 AM.<BR>Now the problem is, I want to block the users if they submit the same time for again. <BR>Any thoughts on how I can acheive this.<BR>I will really appriciate it.<BR>Thanks<BR>Vinay Bansal

  2. #2
    Join Date
    Dec 1969
    Posts
    17

    Default RE: Date and Time Scenario

    Well, if it always uses dec 31 1899 as the default date, then just take the time that the user enters, concatenate it with dec 31 1899, and compare it to all of the datetime fields in the database.

  3. #3
    Join Date
    Dec 1969
    Posts
    38

    Default RE: Date and Time Scenario

    Can you just compare like <BR>if 10:00 AM &#062; 9:30 AM then<BR>do this<BR><BR>What I am confused with is is it going to matter it is AM or PM

  4. #4
    Join Date
    Dec 1969
    Posts
    17

    Default RE: Date and Time Scenario

    I think you can just compare them. Give it a try.<BR>If it doesn&#039t work, then you can convert the times to integers, piece by piece, and then compare those (after adding extra time if it is P.M.).


Posting Permissions

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