473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Converting 25062002120236 to a date!

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
Jul 19 '05 #1
3 1425
*Quintus Snapper* wrote:
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.


In JScript: (watch out for line-wrapping)
var intDate = 25062002120236;
var strDate =
intDate.toString().replace(/(\d{2})(\d{2})(\d{4})(\d{2})(\d{2})(\d{2})/,
"$1-$2-$3 $4:$5:$6");
Response.Write(strDate);
--
Andrew Urquhart
- FAQ: www.aspfaq.com
- Archive: www.tinyurl.com/38kzx
- Contact me: http://andrewu.co.uk/contact/
- This post is probably time-stamped +1 hour - blame my ISP (NTL)
Jul 19 '05 #2
<%
fkdt = "25062002123506"
response.write cdate(mid(fkdt, 5,4) & "-" & mid(fkdt, 3,2) & "-" &
left(fkdt,2))
%>

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Quintus Snapper" <qs******@gmail.com> wrote in message
news:34**************************@posting.google.c om...
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

Jul 19 '05 #3
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
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message news:<OP*************@tk2msftngp13.phx.gbl>...
<%
fkdt = "25062002123506"
response.write cdate(mid(fkdt, 5,4) & "-" & mid(fkdt, 3,2) & "-" &
left(fkdt,2))
%>

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Quintus Snapper" <qs******@gmail.com> wrote in message
news:34**************************@posting.google.c om...
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

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: sunny076 | last post by:
Hi, I am trying to convert from Julian to Gregorian data in C#. I was exploring teh JulianCalendar and Gregorian calendar classes but still not sure how I can do it. For example, the Julian date...
1
by: ree32 | last post by:
I am having problems with Date Strings when using VS.net method of converting an XML document to a dataset. I need the the date nodes to be of date type. As I am loading the Dataset to a...
2
by: John Ortt | last post by:
Hi All, I have a database in Access 97 which works fine but our company is converting from NT4 to XP Pro and in the process changing Office 97 for Office 2003. I have tried to convert the 97...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
2
by: savigliano | last post by:
hello, i am doing a date comparation and i have reallize that the data i have in my database (general date format) it is causing me problems, and because i don´t need the time data i would like to...
6
by: marc | last post by:
hi im trying to convert Date() into a unix timestamp so i can stick the result into a mysql db, please help!
3
by: zshenk | last post by:
I need help converting dates. Currently, I have several tables and databases that use the format 1/20/2007. I have a table right now that uses the 20070120 format, and I was hoping that someone...
3
by: Jef Driesen | last post by:
How can I convert a date string to a number (e.g. a time_t value or a tm struct)? I know about the strptime function, but then I have to know the format string. And that is a problem. I'm trying...
1
by: rob41 | last post by:
I'm in the process of converting numerous queries from access 07 to sql server 05 to improve runtime performance. Below is a sample of code and the error I'm getting. INSERT INTO ( , , ,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.