View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pal Pal is offline
external usenet poster
 
Posts: 27
Default date formating help

I have the function below that returns the YEAR, MONTH, DAY, and HOUR from a
given Julian Day number as input.
But I want to use this as a function that returns MM/DD/YYYY HH:MM in one
cell.

For instance:
tjd= 2451544.5
result = 01/01/2000 12:00
Thanks
Pal


Sub reversejuliandate()
Dim tjd As Double
Dim jyear, jmonth, jday As Long
Dim jhour As Double
Dim coord As Long

tjd = Sheet6.Cells(3, 5)
coord = swe_revjul_d(tjd, 1, jyear, jmonth, jday, jhour)
Sheet6.Cells(20, 2) = jyear
Sheet6.Cells(21, 2) = jmonth
Sheet6.Cells(22, 2) = jday
Sheet6.Cells(23, 2) = jhour
End Sub