Format Datetime Type In Column

Sep 10, 2007

Hi
Can you please help me on this matter please?

I am trying to input UK(for example: 25/09/2007 ) format datetime in sql server. Is there any change that I can format my column to UK datetime. At the moment there is in US format(09/25/2007).

I have a table, one of the column has type datetime.

I use the insert command and the data i want to into is '25/09/2007'

It come back with error that the date is out of range. I change that to 09/09/2007 then it work.
The currently date and time format is MM/DD/YYYY.
I don't know how can i define the format to be DD/MM/YYYY


Thank you very much for your help
i really do appreciate that.

Best regards

View 7 Replies


ADVERTISEMENT

DateTime Format At Column

Oct 1, 2007

HI friends,



Using SmallDateTime in SQL Table, how can I enforce M/DD/YY format on column of type smalldatetime in SQL ServerDB.

What happening is that SQL convert this to YYYY-MM-DD, when my DTS package brings data to table?

Note : output of DTS package is MM/DD/YY format.


Thanks,

View 5 Replies View Related

Format Datetime Column

Jul 13, 2006

Hello,
I am wondering if someone could help me with formatting datatime column.

Goal - keep column in datatime instead of convert to varchar
Current - '2006-06-21 16:54:33.000'
Wants - '2006-06-21 16:54:33'

Any help is appreciated!
-Lawrence

Code Bits
declare @time datetime
set @time = '2006-06-21 16:54:33.000'
select @time, convert(varchar(255), @time, 20)

View 5 Replies View Related

Update Column With Type Datetime

Dec 17, 2007

Hi,I want to update a column typed datetime. My statement is:update 'tablename' set Datum_Ende = '2007-12-17 08:49:04.000' where'columnID_name' = 23250 and 'columndate_Name' = convert(datetime,'17.12.2007 08:08:04')This effects an error. The Server said, the dateTime value is out ofvalid Domain.I have tried various statements like this and i think, the problem isthe blank between date and time.Can someone help me?ThanksThomas

View 2 Replies View Related

Format Of DateTime Column In SELECT Query

Dec 19, 2006

I am using SQL2005 and ASP.NET 2.0
I have one column in database called DateTime and it is defined like type datetime.It is formated like: day.month.year hour:minutes:seconds
My question is: I want to get date from Column DateTime in format day.month.year in SELECT query, not in stored procedure.
 thanks

View 3 Replies View Related

The Most Recent Record From A Datetime Type Column

Apr 5, 2007

I got some issues regarding selecting the most recent record from a datetime type column.
The probelm consists in following:
Table: News
Needed columns: Letter [varchar]
DateTimePublication [datetime]

Table News: Letter DateTimePublication
FR1_dd_mm_yy dd.mm.yy hh:mm:ss
FR1_dd_mm_yy dd.mm.yy hh+1h:mm:ss
FR1_dd_mm_yy dd.mm.yy hh-2h:mm:ss
EN1_dd_mm_yy dd.mm.yy hh+3h:mm:ss
EN1_dd_mm_yy dd.mm.yy hh+4h:mm:ss
EN1_dd_mm_yy dd.mm.yy hh-5h:mm:ss
DU1_dd_mm_yy dd.mm.yy hh:mm:ss
DU1_dd_mm_yy dd.mm.yy hh+1h:mm:ss
DU1_dd_mm_yy dd.mm.yy hh-2h:mm:ss
FR2_dd_mm_yy dd.mm.yy hh:mm:ss
FR2_dd_mm_yy dd.mm.yy hh+1h:mm:ss
FR3_dd_mm_yy dd.mm.yy hh-2h:mm:ss
EN2_dd_mm_yy dd.mm.yy hh+3h:mm:ss
EN3_dd_mm_yy dd.mm.yy hh+4h:mm:ss
EN3_dd_mm_yy dd.mm.yy hh-5h:mm:ss
DU1_dd_mm_yy dd.mm.yy hh:mm:ss
DU3_dd_mm_yy dd.mm.yy hh+1h:mm:ss
DU4_dd_mm_yy dd.mm.yy hh-2h:mm:ss

The ideea is that there are letters with the same name [Letter] but different DateTimePublication ... and I need only the letters with the most recent DateTimePublication for every letter type like FR_dd_mm_yy/EN_dd_mm_yy/DU_dd_mm_yy.

Thank you for your time and consideration!

SenneK

View 4 Replies View Related

Deriving From A Column Date Type Into Format YyyyMMddhhmm

Nov 21, 2007

hi,

i have to derive a column from an existing column in my data source with a data type of DATE.
to illustrate my point lets assume that:

i have dt00 as my current column with its data type of date and now i have to create another column dt01 with data type int.
i need to format the date from dt00 to the following format yyyyMMddhhmm, where


yyyy - year
MM- moth in two digits (e.g: 03, 12)
dd - days in two digits (e.g: 03, 12)
hh - hours in two digits (e.g: 03, 12)
mm - minutes in two digits (e.g: 03, 12)

and allocate this value to this new column dt01.

could someone give me some clue on how to do this using the SCRIPT TASK?


many thanks,


nicolas

View 6 Replies View Related

SQL Server 2014 :: Converting Column Of Type Nvarchar To Datetime

Aug 19, 2015

I am trying to convert a column (nvarchar) to date time.

Here is an example of some values:

20110905
20110901
20111003

As expected, I received the following error: 'Conversion failed when converting date and/or time from character string.'

However, I am unsure how I should approach updating the whole column. I would like the format to be '103'.

View 9 Replies View Related

Transact SQL :: Use Date / Hour And Minute In Datetime Column Type?

Nov 9, 2015

I just need the date, hour, and minute...not the micro seconds. Do I have to DATEPART and concatenate each or is there any way to simply truncate the milliseconds from it? Or is there a date format to put extract and report on it as...

MM/DD/CCYY HH:MM:SS AM

I see there is a format 131 that puts it in..

DD/MM/YYYY HH:MM:SS:MMMAM

View 7 Replies View Related

Getting Error : : The Conversion Of A Char Data Type To A Datetime Data Type Resulted In An Out-of-range Datetime Value

Jan 28, 2008

update tblPact_2008_0307 set student_dob = '30/01/1996' where student_rcnumber = 1830when entering update date in format such as ddmmyyyyi know the sql query date format entered should be in mmddyyyy formatis there any way to change the date format entered to ddmmyyyy in sql query?

View 5 Replies View Related

Transact SQL :: Calculate DateTime Column By Merging Values From Date Column And Only Time Part Of DateTime Column?

Aug 3, 2015

How can I calculate a DateTime column by merging values from a Date column and only the time part of a DateTime column?

View 5 Replies View Related

How To Convert String Data Type To DateTime In Derived Column Control In SSIS Package

Jun 26, 2006

Hi ,

I am Using Derived column between Source and Destination Control. the Source input column PriceTime is String Data type. but in the Destination is should be a DATE TIME column. How to Convert this string to DateTime in the Derivied Column Control.

I already tried to in the Derived column control

PRICEDATETIME <add as new column> ((DT_DBTIMESTAMP)priceDateTime) database timestamp [DT_DBTIMESTAMP]



But still throwing Error showing type case probelm



Pls help me on this



Thanks & Regards

Jeyakumar.M






View 23 Replies View Related

System.Data.SqlClient.SqlException: The Conversion Of A Char Data Type To A Datetime Data Type Resulted In An Out-of-range Datetime Value.

Dec 14, 2005

After testing out the application i write on the local pc. I deploy it to the webserver to test it out. I get this error.

System.Data.SqlClient.SqlException: The conversion of a char data type to a
datetime data type resulted in an out-of-range datetime value.

Notes: all pages that have this error either has a repeater or datagrid which load data when page loading.

At first I thought the problem is with the date, but then I can see
that some other pages that has datagrid ( that has a date field) work
just fine.

anyone having this problem before?? hopefully you guys can help.

Thanks,

View 4 Replies View Related

The Conversion Of A Char Data Type To A Datetime Data Type Resulted In An Out-of-range Datetime Value.

Apr 19, 2008

Advance thanks ....... My table is  TimeSheet:-----------------------------------  CREATE TABLE [dbo].[TimeSheet](    [autoid] [int] IDENTITY(1,1) NOT NULL,    [UserId] [int] NOT NULL,    [starttime] [datetime] NOT NULL,    [endtime] [datetime] NOT NULL,    [summary] [nvarchar](50) NOT NULL,    [description] [nvarchar](50) NULL,    [dtOfEntry] [datetime] NOT NULL,    [Cancelled] [bit] NULL) ON [PRIMARY] My Query is------------------ insert into timesheet (UserId, StartTime,EndTime, Summary, Description,DtOfEntry) values (2, '19/04/2008 2:05:06 PM', '19/04/2008 2:05:06 PM', '66', '6666','19/04/2008 2:05:06 PM')i m not able to insert value Error Message is-------------------------Msg 242, Level 16, State 3, Line 1The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.The statement has been terminated. can any body give any solution  

View 5 Replies View Related

The Conversion Of A Char Data Type To A Datetime Data Type Resulted In An Out-of-range Datetime Value.

Aug 3, 2005

Hey, I have a big problem that i wanna search data from SQL by DateTime like thatselect * from test where recorddate='MyVariableWhichHoldDate'i use variable that holds Date info.i searched a lot infomation on net but there is no perfect solution. i know why this occur but there is no function to solve this problem. i used a lot of ways. it accept yyyy-mm-dd format but my variable format is dd-mm-yyyyy . is there any function for this problem? and any other solution.thanks for ur attentionregards

View 6 Replies View Related

Datetime W/ Format = D Still Showing Time Component Of Datetime

Jan 17, 2008

e.g.

1st March 2005 12:00:00

is showing as

01/03/2005 00:00:00

instead of

01/03/2005


Why does this happen?

View 4 Replies View Related

Date In String Format Has To Be Changed Datetime Format

Jun 15, 2005

I have date coming to one page as a string in the following format"May 4 2005 12:00AM"
I need to query one of my tables using this date in combination of other nondate values. How can I convert this date into valid sql server datetime format before I query a database tables
Please help
 

View 3 Replies View Related

Datetime Data Type Resulted In An Out-of-range Datetime Value. Please Help

May 13, 2006

Hi,
I have a column of type datetime in sqlserver 2000. Whenever I try to insert the date
 '31/08/2006 23:28:59'
 I get the error "...datetime data type resulted in an out-of-range datetime value"
I've looked everywhere and I can't solve the problem. Please note, I first got this error from an asp.net page and in order to ensure that it wasn't some problem with culture settings I decided to run the query straight in Sql Query Anaylser. The results were the same. What else could it be?
cheers,
Ernest

View 2 Replies View Related

Convert Datetime String To Datetime Date Type

Mar 11, 2014

I am inserting date and time data into a SQL Server 2012 Express table from an application. The application is providing the date and time as a string data type. Is there a TSQL way to convert the date and time string to an SQL datetime date type? I want to do the conversion, because SQL displays an error due to the

My date and time string from the application looks like : 3/11/2014 12:57:57 PM

View 1 Replies View Related

Convert DateTime To A DateTime With Milliseconds Format

Nov 5, 2007

Hi,

I am trying to access a date column up to millisecond precession. So I cast date to as follows:



Code BlockCONVERT(varchar(23),CREATE_DATE,121)


I get millisecond part as a result of query but it€™s €œ000€?.

When I try to test the format by using getDate instead of DateTime column I get right milliseconds.





CONVERT(varchar(23),GetDate(),121) --Gives right milliseconds in return

View 4 Replies View Related

Index Creation Causes Error The Conversion Of A Char Data Type To A Datetime Data Type Resulted...

Jul 23, 2005

Hi all,I have a table called PTRANS with few columns (see create script below).I have created a view on top that this table VwTransaction (See below)I can now run this query without a problem:select * from dbo.VwTransactionwhereAssetNumber = '101001' andTransactionDate <= '7/1/2003'But when I create an index on the PTRANS table using the command below:CREATE INDEX IDX_PTRANS_CHL# ON PTRANS(CHL#)The same query that ran fine before, fails with the error:Server: Msg 242, Level 16, State 3, Line 1The conversion of a char data type to a datetime data type resulted inan out-of-range datetime value.I can run the same query by commeting out the AssetNumber clause and itworks fine. I can also run the query commenting out the TransactionDatecolumn and it works fine. But when I have both the conditions in theWHERE clause, it gives me this error. Dropping the index solves theproblem.Can anyone tell me why an index would cause a query to fail?Thanks a lot in advance,AmirCREATE TABLE [PTRANS] ([CHL#] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[CHCENT] [numeric](2, 0) NOT NULL ,[CHYYMM] [numeric](4, 0) NOT NULL ,[CHDAY] [numeric](2, 0) NOT NULL ,[CHTC] [char] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL) ON [PRIMARY]GOCREATE VIEW dbo.vwTransactionsASSELECT CONVERT(datetime, dbo.udf_AddDashes(REPLICATE('0', 2 -LEN(CHCENT)) + CONVERT(varchar, CHCENT) + REPLICATE('0', 4 -LEN(CHYYMM))+ CONVERT(varchar, CHYYMM) + REPLICATE('0', 2 -LEN(CHDAY)) + CONVERT(varchar, CHDAY)), 20) AS TransactionDate,CHL# AS AssetNumber,CHTC AS TransactionCodeFROM dbo.PTRANSWHERE (CHCENT <> 0) AND (CHTC <> 'RA')*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 1 Replies View Related

Unable To Cast Object Of Type 'System.DateTime' To Type 'System.String'.

Dec 31, 2007

 Hi,      I got this field (dateSubmitted) having a data type of DateTime but I receive this error "Unable to cast object of type 'System.DateTime' to type 'System.String'."       All value for dateSubmitted field are 12/27/2007 12:00:00 AM. cheers,imperialx 

View 3 Replies View Related

Millisecond Values Missing When Inserting Datetime Into Datetime Column Of Sql Server

Jul 9, 2007

Hi,
I'm inserting a datetime values into sql server 2000 from c#

SQL server table details
Table nameate_test
columnname datatype
No int
date_t DateTime

C# coding
SqlConnection connectionToDatabase = new SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=testdb;Integrated Security=SSPI");
connectionToDatabase.Open();
DataTable dt1 = new DataTable();
dt1.Columns.Add("no",typeof(System.Int16));
dt1.Columns.Add("date_t", typeof(System.DateTime));
DataRow dr = dt1.NewRow();
dr["no"] = 1;
dr["date_t"] = DateTime.Now;
dt1.Rows.Add(dr);
for(int i=0;i<dt1.Rows.Count;i++)
{
string str=dt1.Rows["no"].ToString();
DateTime dt=(DateTime)dt1.Rows["date_t"];
string insertQuery = "insert into date_test values(" + str + ",'" + dt + "')";
SqlCommand cmd = new SqlCommand(insertQuery, connectionToDatabase);
cmd.ExecuteNonQuery();
MessageBox.Show("saved");
}
When I run the above code, data is inserted into the table
The value in the date_t column is 2007-07-09 22:10:11 000.The milliseconds value is always 000 only.I need the millisecond values also in date_t column.
Is there any conversion needed for millisecond values?

thanks,
Mani

View 3 Replies View Related

Bulk Insert Task Failing On Data Type Conversion For A Destination Column Of Type Bit

Jul 6, 2006

I am trying to use the Bulk Insert Task to load from a csv file. My final column is a bit that is nullable. My file is an ID column that is int, a date column that is mm/dd/yyy, then 20 columns that are real, and a final column that is bit. I've tried various combinations of codepage and datafiletype on my task component. When I have RAW with Char, I get the error included below. If I change to RAW/Native or codepage 1252, I don't have an issue with the bit; however, errors start generating on the ID and date columns.

I have tried various data type settings on my flat file connection, too. I have tried DT_BOOL and the integer datatypes. Nothing seems to work.

I hope someone can help me work through this.

Thanks in advance,

SK



SSIS package "Package3.dtsx" starting.

Error: 0xC002F304 at Bulk Insert Task, Bulk Insert Task: An error occurred with the following error message: "Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.The bulk load failed. The column is too long in the data file for row 1, column 24. Verify that the field terminator and row terminator are specified correctly.Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 23 (cancelled).".

Error: 0xC002F304 at Bulk Insert Task 1, Bulk Insert Task: An error occurred with the following error message: "Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.The bulk load failed. The column is too long in the data file for row 1, column 24. Verify that the field terminator and row terminator are specified correctly.Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 23 (cancelled).".

Task failed: Bulk Insert Task 1

Task failed: Bulk Insert Task

Warning: 0x80019002 at Package3: The Execution method succeeded, but the number of errors raised (2) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.

SSIS package "Package3.dtsx" finished: Failure.

View 5 Replies View Related

The Conversion Of A Char Data Type To A Datetime Data Type!!

May 13, 2008

hello all .. I have a form that includes two textboxes (Date and Version) .. When I try to insert the record I get the following error message .. seems that something wrong with my coversion (Data type)"The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.The statement has been terminated."
 
in my SQL database I have the date feild as datetime and the version as nvarchar(max)
this is the code in the vb page .. Can you please tell me how to solve this problem?Imports System.Data.SqlClient
Imports system.web.configuration

Partial Class Admin_emag_insert
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Record_DateTextBox.Text = DateTime.Now

End Sub

Protected Sub clearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles clearButton.Click
Me.VersionTextBox.Text = ""
End Sub

Protected Sub addButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles addButton.Click
Dim objConnection As SqlConnection
Dim objDataCommand As SqlCommand
Dim ConnectionString As String
Dim record_date As Date
Dim version As String
Dim emagSQL As String

'save form values in variables
record_date = Record_DateTextBox.Text
version = VersionTextBox.Text

ConnectionString = WebConfigurationManager.ConnectionStrings("HRDBConnectionString").ConnectionString

'Create and open the connection
objConnection = New SqlConnection(ConnectionString)
objConnection.Open()
emagSQL = "Insert into E_Magazine (Record_Date, Version ) " & _
"values('" & record_date & "','" & version & "')"

'Create and execute the command
objDataCommand = New SqlCommand(emagSQL, objConnection)
objDataCommand.ExecuteNonQuery()
objConnection.Close()

AddMessage.Text = "A new emagazine was added successfully"

Me.VersionTextBox.Text = ""

End Sub
End Class
 

View 10 Replies View Related

DateTime Format

Dec 20, 2006

Hello all,
I'm trying to write a query against an exisiting table that i can't modify and i'm running into a bit of a problem. The table stores timestamps as a char field instead of a datetime.
So, i've had to use the CONVERT function to change it to a datetime during my query. A sample is below:
SELECT convert(datetime, logged, 120) FROM AP200310
This works, except i want to include the option of querying a single day. Since the data that is returned is in this format:
12/12/2006 6:54:15 PM
The following sql statement doesn't work:SELECT convert(datetime, logged, 120) FROM AP200310 WHERE logged = '12/12/2006'
Thanks in advance for any help.
 

View 7 Replies View Related

Sql Datetime Format

Jan 26, 2007

Hi, I wanted to take a date from my Sql server. it is save as dd/mm/yyyy. but when i use the select command it return me dd-mm-yyyyT00:00:00.0000000+08:00. i try to use this following code but it is not working....thedate = String.Format("{0:dd/MM/yyyy}", (reader.GetSqlDateTime(1))) 
here is my complete codePublic Function deleteOrder(ByVal oid As Integer) As String
conn = dbCon.getConnection()
Dim cmd1 As New SqlCommand
Dim reader As SqlDataReader
Dim valid, sendDate, sd As String
Dim thedate As String
Dim cancelPeriod As String = CStr(System.DateTime.Today.AddDays(+3))

cmd1.CommandText = "select orderSendDate " & _
"from orders " & _
"where orderID = @oid"
cmd1.Parameters.Add("@oid", oid)
cmd1.Connection = conn
conn.Open()
reader = cmd1.ExecuteReader()

If Not reader.HasRows Then
valid = "No match found"
Else
If reader.Read Then

'String.Format("{0:dd/MM/yyyy}",(dr.GetSqlDateTime(1)));
thedate = String.Format("{0:dd/MM/yyyy}", (reader.GetSqlDateTime(1)))
'sd = reader("orderSendDate").ToString
'sendDate = sd.Substring(0, 10)
conn.Close()
End If
End If
'Return errMsg
If thedate = Convert.ToDateTime(cancelPeriod) Or thedate < CStr(System.DateTime.Today.AddDays(+3)) Then
valid = "You are not allowed to change"
Else
Try
conn.Open()
Dim strUpdate As String
Dim cmd As New SqlCommand
strUpdate = "update orders set orderStatus = @os where orderID = @oid"
cmd.Parameters.Add("@os", "c")
cmd.Parameters.Add("@oid", oid)

cmd.CommandText = strUpdate
cmd.Connection = conn
cmd.ExecuteNonQuery()
conn.Close()
valid = "Cancellation succesful"
updateOrderItemStatus(oid)
Catch ex As Exception
'Response.Write(ex.Message)
errMsg = ex.Message
conn.Close()
End Try
End If

Return valid
End Function

When i call my web method it gives me an error saying that page is not found... please teach me how to convert it.
thx
 
 

View 3 Replies View Related

DATETIME FORMAT

Mar 1, 2007

  Datetime for using SQLSERVER QUERY NOT ANOTHER
 
MM/DD/YYYY HH:MM:SS AM/PM format using only sql query not using SUBSTRING ANY IDEAS
 
????
 regards
sadeesh
 

View 1 Replies View Related

DateTime Format -

Jul 10, 2007

I have installed the trial version of windows server 2003 on the second hard drive on my computer. I set up IIS and ran my website on it but the problem is when I do something on the site, which has a sql insert statement regarding datetime.now it says, "conversion failed when converting datetime from character string"
 
I think it's to do with the clock on server 2003, the format is like: 11/07/2007 2:39:59 a.m. 
I think it should be in format AM and not a.m.
 Any ideas on how to change the time format on a computer?
 
 Or should I just change the Columns in my table to a Nvarcher value or something?
 
thanks
 
 

View 8 Replies View Related

Datetime Format

May 7, 2004

Hello:

Hello:
I have some code in a asp.net function in C# like this:

DateTime datetime = DateTime.Now;

SqlCommand CommandEvent = new SqlCommand("spAddNewEvents", Connection);
CommandEvent.Transaction = Trans;
CommandEvent.CommandType = CommandType.StoredProcedure;

*I try First : CommandEvent.Parameters.Add("@date", datetime);
*I try Secound: CommandEvent.Parameters.Add("@date", SqlDbType.DateTime,
8).Value = datetime;

and have some storeprocedure with this code

CREATE PROCEDURE dbo.spAddEvents
(
@guid uniqueidentifier,
@language char (2),
@date as datetime,
@eventId as varchar (50),
@userid as varchar (20)
)
AS
execute('insert into tblEvents'+@language+'( guid, [date], [id], userid)
values('''+@guid+''','''+@date+''','+@eventId+','''+@userId+''')')

GO

The problem is when I try to insert a new event. The event insert are fine,
but the datetime's secound in tblEvents always is 00, and I check the
datetime variable to insert and have secound different that 00.

the table definition is Data Type: datetime and Length: 8, how must be?

I run Profiler and a I get this:

exec spAddEvents @Guid = 'C879D062-C268-4A3E-8D58-1937B7612EC2', @language = N'ES', @date = 'May 6 2004 11:29:58:140PM', @eventId = 6, @userid = N'anibal'

Best regards.
Owen.

View 1 Replies View Related

DateTime Format

Jun 10, 2006

Hi,I'm new to SQL Server (Express) and I wonder if there is a way that I can format a date's appearance in the database, that is, the format of the datetime column.
When I view a date in VWD Express, it's in my country's format (2006-11-24 for example) but when I try to insert a date using the same format using a web form, the inserted date in the database becomes 1905-06-something. This happens regardless of whether I'm inserting a string or if the string has been converted to a date via CDate.
So, is there a way I can set the database's date format? And why is it wrong anyway? It's bugging me as the original (Swedish) date is already in the ISO format that SQL Server seems to use (such as yyyy-mm-dd), and I'm using localhost with Windows set to Swedish, IE 6 set to Swedish, and even web.config's UICulture and Culture to Swedish as well.
Of course, I can rearrange the order of the date's numbers to get proper values in the db, but it seems as an unnecessary step and I can't figure out what format to use anyway.
All help is very welcome.
Pettrer

View 6 Replies View Related

Datetime Format, Can This Be Done

Jun 24, 2002

Hi There,

I'm in a learning phase of SQL server 7. I need your help for the following:

I am selecting from a dropdown list Month ('January, february,..... but not as '01', '02'..) and Year (2000, 2001.....), when they are selected a table is displayed for next 12 months starting from the selected month (like say, if April and 2002 was selected, my other table will show Apr. 02 - Mar. 03 ), and data is inserted into it manually.
My question is How to insert this date into the sql database...as I just need the month and the year.....and in sql server the date datatype is "datetime", also i have only one column for this month and year....should i change my tables and make different columns for Month and Year. Can only Month (Januray, february.....) and Year (2000, 2001...) be inserted.

View 1 Replies View Related

Datetime Format

May 30, 2007

Dear Folks,
how can i know the datetime format of my current session? and is it possible to change that to required format permanently for that particular database?



thank you very much

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved