Converting 25062002120236 to a date!

  • Thread starter Quintus Snapper
  • Start date
Q

Quintus Snapper

How can I convert a string such as 25062002120236 into a date
(25-06-2002 12:02:36). I have tried using the CDate() & ISDate()
functions but they don't recognise and convert this into a date.

Thanks in advance,

Quintus
 
A

Aaron [SQL Server MVP]

<%
fkdt = "25062002123506"
response.write cdate(mid(fkdt, 5,4) & "-" & mid(fkdt, 3,2) & "-" &
left(fkdt,2))
%>
 
Q

Quintus Snapper

Thanks! works like a charm, easy when you know how!

Should someone also have a similar issue and also wants the time, it
would look like:

fkdt = "25062002123506
cdate(mid(fkdt, 5,4) & "-" & mid(fkdt, 3,2) & "-" & left(fkdt,2) & " "
& mid(fkdt, 9,2) & ":" & mid(fkdt, 11,2) & ":" & mid(fkdt, 13,2))

Q
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,159
Messages
2,570,881
Members
47,418
Latest member
NoellaXku

Latest Threads

Top