Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 1234»»»

Dealing with custom date formats in T-SQL Expand / Collapse
Author
Message
Posted Friday, March 23, 2012 12:04 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 1:26 AM
Points: 4,651, Visits: 11,109
Comments posted to this topic are about the item Dealing with custom date formats in T-SQL

--
Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
Post #1271388
Posted Friday, March 23, 2012 12:30 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:15 AM
Points: 13,633, Visits: 11,504
Very nice article. The FORMAT function seems very promising!
One small remark: maybe include a link to the BOL page of CONVERT you're referring to. (although it's pretty easy to find using Google/Bing )




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1271403
Posted Friday, March 23, 2012 1:25 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 1:26 AM
Points: 4,651, Visits: 11,109
Thank you, Koen.
The BOL page for CONVERT is linked in the "built-in method so far" section. unfortunately hyperlinks are not easy to spot both on the forums and on the articles. The font is not much different from the regular text and I decided to emphasizes it with bold.


--
Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
Post #1271428
Posted Friday, March 23, 2012 1:27 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:15 AM
Points: 13,633, Visits: 11,504
Gianluca Sartori (3/23/2012)
Thank you, Koen.
The BOL page for CONVERT is linked in the "built-in method so far" section. unfortunately hyperlinks are not easy to spot both on the forums and on the articles. The font is not much different from the regular text and I decided to emphasizes it with bold.


Whoops, you're right
Apparently I totally missed it. Disregard my statement




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1271429
Posted Friday, March 23, 2012 1:51 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, November 26, 2014 3:52 AM
Points: 249, Visits: 164
No mention of ISO date formats?

If the discussion is around how to present locale-specific date formats I would understand, but when converting dates an international standard must be one of the things that should be considered to detect malformed dates and prevent transposed dates.

Of course, it might just be easier to get the yanks to comply with the rest of the world in the first place!
Post #1271436
Posted Friday, March 23, 2012 3:10 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Monday, December 15, 2014 9:36 AM
Points: 652, Visits: 1,901
I think this is a great article, with a lot of tasty code to chew over.

Thanks for putting in the effort and sharing!
Post #1271469
Posted Friday, March 23, 2012 3:13 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 1:26 AM
Points: 4,651, Visits: 11,109
surreydude. (3/23/2012)
No mention of ISO date formats?

If the discussion is around how to present locale-specific date formats I would understand, but when converting dates an international standard must be one of the things that should be considered to detect malformed dates and prevent transposed dates.


ISO 8601 dates are handled by SQL Server using the CONVERT function, with styles 126 and 127.
See here for more detail: http://msdn.microsoft.com/en-us/library/ms187928.aspx

Of course, it might just be easier to get the yanks to comply with the rest of the world in the first place!


Well, they did (sort of).
As a side note, I'm not a "yank".


--
Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
Post #1271472
Posted Friday, March 23, 2012 3:14 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 1:26 AM
Points: 4,651, Visits: 11,109
David McKinney (3/23/2012)
I think this is a great article, with a lot of tasty code to chew over.

Thanks for putting in the effort and sharing!


Thank you, David.


--
Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
Post #1271474
Posted Friday, March 23, 2012 3:31 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, May 7, 2013 3:46 PM
Points: 6, Visits: 34
If you want a commercially-supported CLR-based utility for this our SQLUtilities product includes a wide range of date formatting & parsing functions, as well as other useful date/time, string handling and numeric functions (e.g. return a dynamically-generated sequence of dates and/or times as a table-valued function).

Charles Southey
www.totallysql.com


Charles Southey
www.totallysql.com
Post #1271478
Posted Friday, March 23, 2012 3:50 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 1:26 AM
Points: 4,651, Visits: 11,109
charles.southey (3/23/2012)
If you want a commercially-supported CLR-based utility for this our SQLUtilities product includes a wide range of date formatting & parsing functions, as well as other useful date/time, string handling and numeric functions (e.g. return a dynamically-generated sequence of dates and/or times as a table-valued function).

Charles Southey
www.totallysql.com


Charles, I'm not sure this is a good way to promote your product.
I don't know if the editors are happy with ADs on these forums. Have you checked it with them before posting?


--
Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
Post #1271484
« Prev Topic | Next Topic »

Add to briefcase 1234»»»

Permissions Expand / Collapse