Click here to Skip to main content
11,789,710 members (60,741 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: SQL
I am getting some files from third party server .
In this file Date is coming like this -


I mean to say some time 6 digit some 8 digit,How we convert it in valid date or date time format.
Posted 20-Sep-12 19:59pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

For 8 digit like '20120921' it is possible to convert.
select convert(date,'20120921',103)

for six digit u need to append '01' to form a valid date and then convert it in same fashion.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 999
1 Maciej Los 765
2 KrunalRohit 686
3 CPallini 606
4 Richard MacCutchan 430

Advertise | Privacy | Mobile
Web02 | 2.8.1509028.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100