Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Convert String to Date

Posted on 2008-09-30
2
Medium Priority
?
262 Views
Last Modified: 2008-09-30
How do I convert the following String to Date with a formula
String "050708"
Where 05 is the day, 07 is the month and 08 is the month
So I would get the output like
05-July-08
0
Comment
Question by:ranhell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 10

Author Comment

by:ranhell
ID: 22607666
Correction
How do I convert the following String to Date with a formula
String "050708"
Where 05 is the day, 07 is the month and 08 is the year
So I would get the output like
05-July-08
0
 
LVL 10

Accepted Solution

by:
ranhell earned 0 total points
ID: 22608795
I figure it out by myself

Local NumberVar ano;
Local NumberVar mes;
Local NumberVar dia;
if Length ({TEMPIN.CB}) = 30 then
(   dia := tonumber(left(right({TEMPIN.CB},27),2)) ;
    mes := tonumber (left(right({TEMPIN.CB},24),1));
    ano := tonumber (left(right({TEMPIN.CB},23),2))+ 2000;
    datevalue(ano,mes,dia);
)

Else
(   dia := tonumber(left(right({TEMPIN.CB},15),2)) ;
    mes := tonumber (left(right({TEMPIN.CB},12),1));
    ano := tonumber (left(right({TEMPIN.CB},11),2))+ 2000;
    datevalue(ano,mes,dia);
)
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hi, In my previous Article  (http://www.experts-exchange.com/Database/Reporting/A_15199-Introduction-to-Microstrategy.html)I discussed some basic understanding of Microstrategy that how we can get in Intro of Microstrategy (MSTR). Now it's tim…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question