Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 24th, 2009, 08:30 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Question Convert date to JDEdwards date format

I am trying to convert a date field to a JDEdwards date field which is 6 numeric (century = 1 position, year = 2 positions and day withing year = 3 positions).

I have a date of 8/4/2008 (mdyy) and that needs to be converted to 108217.

My code converts the date to 1008217 which is wrong (one zero too much)

Code:
 
Dim JdeDateFrom As Integer = (CLng(Format(Year(Date_From), "0000") + Format(DateDiff("d", CDate("01/01/" + Format(Year(Date_From), "0000")), Date_From) + 1, "000"))) - 1000000
 
Old March 24th, 2009, 08:54 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Think I figured it out:

Code:
 
Dim JdeDateFrom As Integer = (CLng(Format(Year(Date_From), "0000") + Format(DateDiff("d", CDate("01/01/" + Format(Year(Date_From), "0000")), Date_From) + 1, "000"))) - 1900000





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert British format date to American format? fyr PHP How-To 0 December 19th, 2007 03:17 PM
how can i convert date into format '2007-10-25T11: vishnu108mishra C# 2 November 23rd, 2007 04:45 AM
XSLT - Convert the date in different format haixia XSLT 1 August 25th, 2006 11:51 AM
Formula to convert date format narooma.12 Crystal Reports 0 April 20th, 2005 04:54 PM
Convert date format ciko1973 Access VBA 3 June 18th, 2003 04:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.