Text to Date

shettarvikas
Member Posts: 106
Hi,
How can we convert a text(having integer values) to date..
eg: Text := 20081224 (YYYYMMDD) to date 12/24/2008
same way need to conver text to Time
eg: Text = 192059 (hhmmss) to 19:20:59
Thanks & regards,
Vikas
How can we convert a text(having integer values) to date..
eg: Text := 20081224 (YYYYMMDD) to date 12/24/2008
same way need to conver text to Time
eg: Text = 192059 (hhmmss) to 19:20:59
Thanks & regards,
Vikas
0
Comments
-
shettarvikas wrote:Hi,
How can we convert a text(having integer values) to date..
eg: Text := 20081224 (YYYYMMDD) to date 12/24/2008
same way need to conver text to Time
eg: Text = 192059 (hhmmss) to 19:20:59
Thanks & regards,
Vikas
Simply..
datef : variable date type
EVALUATE(datef, COPYSTR(text,5,2)+'/'+COPYSTR(text,7,2)+'/'+COPYSTR(text,1,4));
LOL0 -
if your format of table will be remain same for every time then your can
use following code.
year := copystr(datetext,1,4);
month := copystr(datetext,5,2);
day := copystr(datetext,7,2);
Evaluate(Dy,Day);
evaluate(mm,month);
evaluate(yy,year);
DesireDate := DMY2Date(mm,dy,yy);
for time
TextToTime(VarText : Text[8]) : Time
BaseVarTime := 111111T;
TimeSeparator := COPYSTR(FORMAT(BaseVarTime),3,1);
EVALUATE(VarTime,CONVERTSTR(VarText,':',TimeSeparator));
EXIT(VarTime);Experience Makes Man Perfect....
Rajesh Patel0 -
hi..
thanks both of u!!!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions