Storing Datetime in MS SQL server

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
nawhaley
Forum Commoner
Posts: 85
Joined: Wed May 18, 2005 11:43 am

Storing Datetime in MS SQL server

Post by nawhaley »

I'm trying to store the date and time in my MSSQL server but I cannot find any documentation on a valid way to enter this into the SQL database. do you have to get just the date then the time seperately and put them in , do you do it all as one line or what?
nincha
Forum Contributor
Posts: 191
Joined: Fri Mar 28, 2003 12:30 pm
Location: CA, USA

Post by nincha »

never use mssql, but can you just use the php's date function then just query it to your database?
nawhaley
Forum Commoner
Posts: 85
Joined: Wed May 18, 2005 11:43 am

Post by nawhaley »

not sure that will work the date() function itself lets you put the date and time in dozens of formats. I dont think all of those are valid to be stored in the SQL database and I'd rather not spend hrs trying to get one to take I'd rather know which ones are valid and which are not. Does anyone have a link going over this or know it off hand?
nincha
Forum Contributor
Posts: 191
Joined: Fri Mar 28, 2003 12:30 pm
Location: CA, USA

Post by nincha »

nawhaley
Forum Commoner
Posts: 85
Joined: Wed May 18, 2005 11:43 am

Post by nawhaley »

I had found both of those and he isnt very specifice in explaining his table layout so the examples make little sense in how you physically put the data into the database.
Player1005
Forum Newbie
Posts: 2
Joined: Fri Jan 06, 2006 6:12 pm

Post by Player1005 »

when you consult the "books online" that comes with MS SQL that is always a very good and reliable source for info.
with the query analyzer you can test our queries very comfortable.
Post Reply