April 26, 2018 at 12:44 am
Hi Experts,
We have a datetime field where date time is saved in below format.
Apr 19 2018 8:57AM
But want to update in below format. Is it possible for existing data. All new data format is changed through code.
2018-04-2018T08:57:00
April 26, 2018 at 12:55 am
VastSQL - Thursday, April 26, 2018 12:44 AMHi Experts,We have a datetime field where date time is saved in below format.
Apr 19 2018 8:57AMBut want to update in below format. Is it possible for existing data. All new data format is changed through code.
2018-04-2018T08:57:00
The datetime data type does not store any format, only the date and time values.
😎
Have a look at datetime (Transact-SQL)
April 26, 2018 at 3:05 am
Eirikur Eiriksson - Thursday, April 26, 2018 12:55 AMVastSQL - Thursday, April 26, 2018 12:44 AMHi Experts,We have a datetime field where date time is saved in below format.
Apr 19 2018 8:57AMBut want to update in below format. Is it possible for existing data. All new data format is changed through code.
2018-04-2018T08:57:00The datetime data type does not store any format, only the date and time values.
😎Have a look at datetime (Transact-SQL)
Thanks Eirikur
April 26, 2018 at 3:55 am
VastSQL - Thursday, April 26, 2018 3:05 AMEirikur Eiriksson - Thursday, April 26, 2018 12:55 AMVastSQL - Thursday, April 26, 2018 12:44 AMHi Experts,We have a datetime field where date time is saved in below format.
Apr 19 2018 8:57AMBut want to update in below format. Is it possible for existing data. All new data format is changed through code.
2018-04-2018T08:57:00The datetime data type does not store any format, only the date and time values.
😎Have a look at datetime (Transact-SQL)
Thanks Eirikur
You are welcome.
😎
April 30, 2018 at 10:37 am
Eirikur Eiriksson - Thursday, April 26, 2018 12:55 AMVastSQL - Thursday, April 26, 2018 12:44 AMHi Experts,We have a datetime field where date time is saved in below format.
Apr 19 2018 8:57AMBut want to update in below format. Is it possible for existing data. All new data format is changed through code.
2018-04-2018T08:57:00The datetime data type does not store any format, only the date and time values.
😎Have a look at datetime (Transact-SQL)
You have a whole bunch of conceptual errors and don't know what how SQL works. Let's start with the basics; a column is not a field. If you want to read the standard you'll see the term field refers to part of a data type display in SQL in SQL columns have datatypes, which are abstracted and have nothing to do with physical storage choices.
However, the standards also have one and only one display format for daytime data. That format is based on ISO 8601, and looks like "YYYY-MM-DD HH:MM:SS.sss" which you seem to be moving to. The problem is that only put this in the standard, we left out the "T" separator in SQL. Frankly, I wish we had left it in, but that's what we voted on.
Please post DDL and follow ANSI/ISO standards when asking for help.
April 30, 2018 at 10:48 am
As noted, the datetime is stored in a numeric format.
It's likely that whatever interface is displaying the date to you is putting it in this format:
Apr 19 2018 8:57AM
If you want to explicitly generate this format:
2018-04-2018T08:57:00
you can do this:
SELECT CONVERT(varchar(19), datetime_column, 126)
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
April 30, 2018 at 11:54 am
jcelko212 32090 - Monday, April 30, 2018 10:37 AMEirikur Eiriksson - Thursday, April 26, 2018 12:55 AMVastSQL - Thursday, April 26, 2018 12:44 AMHi Experts,We have a datetime field where date time is saved in below format.
Apr 19 2018 8:57AMBut want to update in below format. Is it possible for existing data. All new data format is changed through code.
2018-04-2018T08:57:00The datetime data type does not store any format, only the date and time values.
😎Have a look at datetime (Transact-SQL)
You have a whole bunch of conceptual errors and don't know what how SQL works. Let's start with the basics; a column is not a field. If you want to read the standard you'll see the term field refers to part of a data type display in SQL in SQL columns have datatypes, which are abstracted and have nothing to do with physical storage choices.
However, the standards also have one and only one display format for daytime data. That format is based on ISO 8601, and looks like "YYYY-MM-DD HH:MM:SS.sss" which you seem to be moving to. The problem is that only put this in the standard, we left out the "T" separator in SQL. Frankly, I wish we had left it in, but that's what we voted on.
Jeez, Joe... how many time do I have to prove to you that the format you're touting as the "one and only one display format for daytime data" is actually an alternate format that is allow and that the original format in the ISO 8601 standard does NOT include any dashes. There's also the problem of different language basis being used in SQL Server will also swap MM-DD in your supposed air tight format. Of course, I've proven that several times as well but you seem to be stuck on some very bad information.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 30, 2018 at 12:32 pm
Jeff Moden - Monday, April 30, 2018 11:54 AMjcelko212 32090 - Monday, April 30, 2018 10:37 AMEirikur Eiriksson - Thursday, April 26, 2018 12:55 AMVastSQL - Thursday, April 26, 2018 12:44 AMHi Experts,We have a datetime field where date time is saved in below format.
Apr 19 2018 8:57AMBut want to update in below format. Is it possible for existing data. All new data format is changed through code.
2018-04-2018T08:57:00The datetime data type does not store any format, only the date and time values.
😎Have a look at datetime (Transact-SQL)
You have a whole bunch of conceptual errors and don't know what how SQL works. Let's start with the basics; a column is not a field. If you want to read the standard you'll see the term field refers to part of a data type display in SQL in SQL columns have datatypes, which are abstracted and have nothing to do with physical storage choices.
However, the standards also have one and only one display format for daytime data. That format is based on ISO 8601, and looks like "YYYY-MM-DD HH:MM:SS.sss" which you seem to be moving to. The problem is that only put this in the standard, we left out the "T" separator in SQL. Frankly, I wish we had left it in, but that's what we voted on.
Jeez, Joe... how many time do I have to prove to you that the format you're touting as the "one and only one display format for daytime data" is actually an alternate format that is allow and that the original format in the ISO 8601 standard does NOT include any dashes. There's also the problem of different language basis being used in SQL Server will also swap MM-DD in your supposed air tight format. Of course, I've proven that several times as well but you seem to be stuck on some very bad information.
If I understand the standard correctly, the non-dashed version is the standard for dates (without the time component) while the dashed version is the standard when there is a time component.
YYYYMMDD
vs
YYYY-MM-DD hh:mm:ss.nnnnnnn
April 30, 2018 at 6:58 pm
Jason A. Long - Monday, April 30, 2018 12:32 PMJeff Moden - Monday, April 30, 2018 11:54 AMjcelko212 32090 - Monday, April 30, 2018 10:37 AMEirikur Eiriksson - Thursday, April 26, 2018 12:55 AMVastSQL - Thursday, April 26, 2018 12:44 AMHi Experts,We have a datetime field where date time is saved in below format.
Apr 19 2018 8:57AMBut want to update in below format. Is it possible for existing data. All new data format is changed through code.
2018-04-2018T08:57:00The datetime data type does not store any format, only the date and time values.
😎Have a look at datetime (Transact-SQL)
You have a whole bunch of conceptual errors and don't know what how SQL works. Let's start with the basics; a column is not a field. If you want to read the standard you'll see the term field refers to part of a data type display in SQL in SQL columns have datatypes, which are abstracted and have nothing to do with physical storage choices.
However, the standards also have one and only one display format for daytime data. That format is based on ISO 8601, and looks like "YYYY-MM-DD HH:MM:SS.sss" which you seem to be moving to. The problem is that only put this in the standard, we left out the "T" separator in SQL. Frankly, I wish we had left it in, but that's what we voted on.
Jeez, Joe... how many time do I have to prove to you that the format you're touting as the "one and only one display format for daytime data" is actually an alternate format that is allow and that the original format in the ISO 8601 standard does NOT include any dashes. There's also the problem of different language basis being used in SQL Server will also swap MM-DD in your supposed air tight format. Of course, I've proven that several times as well but you seem to be stuck on some very bad information.
If I understand the standard correctly, the non-dashed version is the standard for dates (without the time component) while the dashed version is the standard when there is a time component.
YYYYMMDD
vs
YYYY-MM-DD hh:mm:ss.nnnnnnn
That's not correct. I can't post a quote from section "4.3.2 Complete representations" of the standard because of the way the damned copyright is written but it clearly states that both forms are allowed whether or not the time is included or not. Basically, if you include the dashes in the date, the "extended format" says that you should also use colons in the time and the "T" separator is optional by agreement. If dashes are not included in the date, then the "basic format" does not include the colons in the time.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 2, 2018 at 6:46 am
This was removed by the editor as SPAM
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply