Click here to Skip to main content
12,635,428 members (24,863 online)
Rate this:
 
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
rummer976

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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161208.2 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2016
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