Re: Date and Time
From: Bob Barrows [MVP] (reb01501_at_NOyahoo.SPAMcom)
Date: 08/06/04
- Next message: Bob Barrows [MVP]: "Re: querying a view of a lot tables"
- Previous message: Anthony: "Re: ASP Web Based nslookup"
- In reply to: Paweł Janowski: "Re: Date and Time"
- Next in thread: Paweł Janowski: "Re: Date and Time"
- Reply: Paweł Janowski: "Re: Date and Time"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 6 Aug 2004 19:06:39 -0400
Again, datetimes are not stored with any format. They are stored as integer
pairs. The first integer contains the number of days since the seed date.
The second contains the number of milliseconds since midnight. There is
absolutely no point to trying to store a datetime with any format. Formats
must be applied when displaying the dates retrieved from the column.
For more information, check out the BOL article, Using Date and Time Data.
Bob Barrows
Paweł Janowski wrote:
> set dateformat dmy
>
> this force DD/MM/YYYY
>
>
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:um1zQ67eEHA.2560@TK2MSFTNGP09.phx.gbl...
>> Pawel Janowski wrote:
>>> "dave" <anonymous@discussions.microsoft.com> wrote in message
>>> news:10cf01c47b47$c67dbc80$a401280a@phx.gbl...
>>>> Hello
>>>> I have one field Dt_Time in sql server 2000.
>>>> I want to insert current Date (if possible then
>>>> DD/MM/YYYY)and Time in that field..What should be the SQL
>>>> for that?
>>>> Any help would be appreciated..
>>>> Thanx
>>>> Dave
>>>
>>> (BOL Bookz online) CAST and CONVERT
>>> in MSSQL insert directive :
>>> set dateformat dmy
>>> print convert(char(10),getdate(),103)
>>>
>>>
>>> Pawel Janowski
>>> www.sunrise-tm.com
>>> www.koluszki.net
>>
>> Why bring up CAST and CONVERT? The 103 style will be ignored when
>> the date is stored in the table. A simple:
>>
>> UPDATE tablename
>> SET Dt_Time = GETDATE()
>> WHERE ...
>>
>> or
>>
>> INSERT INTO tablename (Dt_Time, <list of other columns>)
>> VALUES (GETDATE(),<list of other values>)
>>
>> will suffice.
>>
>> Bob Barrows
>>
>> --
>> Microsoft MVP - ASP/ASP.NET
>> Please reply to the newsgroup. This email account is my spam trap so
>> I don't check it very often. If you must reply off-line, then remove
>> the "NO SPAM"
-- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
- Next message: Bob Barrows [MVP]: "Re: querying a view of a lot tables"
- Previous message: Anthony: "Re: ASP Web Based nslookup"
- In reply to: Paweł Janowski: "Re: Date and Time"
- Next in thread: Paweł Janowski: "Re: Date and Time"
- Reply: Paweł Janowski: "Re: Date and Time"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|