LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default date conversion....

Dave - that's awesome....exactly what I needed.

Thanks !

Eric

"Dave Peterson" wrote:

This formula seems to do the same as your worksheet formula:

=1000*(YEAR(TODAY())-1900)+TODAY()-DATE(YEAR(TODAY()),1,0)

This worked ok in code:

Dim EffDate As Long
EffDate = 1000 * (Year(Date) - 1900) + Date - DateSerial(Year(Date), 1, 0)
MsgBox EffDate



Eric @ BP-EVV wrote:

The following formula works fine in an excel spreadsheet:

=(RIGHT(YEAR(TODAY()),2)&TEXT(TODAY()-DATE(YEAR(TODAY()),1,0),"000"))+100000

to convert today's date to my company's version of a Julian date.

10/29/2008 = 108303

I'm trying to do this calculation "on the fly" within VB code since I need
the converted date in order to execute a SQL statement against our AS/400
database to return data to Excel.

I can't seem to get it right....

dim effdate as long

effdate =
application.worksheetfunction.(RIGHT(YEAR(TODAY()) ,2)&TEXT(TODAY()-DATE(YEAR(TODAY()),1,0),""000""))+100000

doesn't seem to cut it.....any ideas ??

Thanks !


--

Dave Peterson

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Conversion Lindsey Excel Discussion (Misc queries) 4 March 18th 09 04:21 PM
Date Conversion billbrandi Excel Discussion (Misc queries) 3 July 23rd 07 03:58 AM
Date Conversion Port Man Excel Discussion (Misc queries) 6 March 2nd 07 12:55 AM
Date conversion SITCFanTN Excel Programming 11 June 8th 06 11:06 PM
Date Conversion jdmcleod Excel Discussion (Misc queries) 2 March 20th 05 12:12 AM


All times are GMT +1. The time now is 05:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"