Click here to Skip to main content
Rate this: bad
good
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 -
 
20300101
209912
201209
20200209
 
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 20:59pm
rummer846

1 solution

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

Solution 1

Hi,
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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 305
1 OriginalGriff 225
2 DamithSL 130
3 Kornfeld Eliyahu Peter 130
4 Peter Leow 95
0 OriginalGriff 7,355
1 DamithSL 5,199
2 Sergey Alexandrovich Kryukov 4,942
3 Maciej Los 4,906
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2014
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