ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Converting Julian Seconds with a macro to replace old seconds data (https://www.excelbanter.com/excel-discussion-misc-queries/72362-converting-julian-seconds-macro-replace-old-seconds-data.html)

Keldair

Converting Julian Seconds with a macro to replace old seconds data
 
I have just recently converted an access database to excel and in the data is
some fields with the date/time stored as julian seconds. In access I used to
just use a macro to convert and display it on a form, but I can no longer do
that.

I just wish to convert the data to a mm/dd/yyyy format, but I am unsure how
to with excel.

This is the function.

Function JulianSecondsToDateTime(IngJulianSeconds As Long) As Date

'Julian Seconds plus 68 years to make compatible with Access
JulianSecondsToDateTime = DateAdd("yyyy", 68, CDate(IngJulianSeconds / 86400))

End Function

Is there a way to do so?

Fred Smith

Converting Julian Seconds with a macro to replace old seconds data
 
One way to apply the same conversion as your Access function is:

=date(year(a1/86400)+68,month(a1/86400),day(a1/86400))

Does this help?

--
Regards,
Fred


"Keldair" wrote in message
...
I have just recently converted an access database to excel and in the data is
some fields with the date/time stored as julian seconds. In access I used to
just use a macro to convert and display it on a form, but I can no longer do
that.

I just wish to convert the data to a mm/dd/yyyy format, but I am unsure how
to with excel.

This is the function.

Function JulianSecondsToDateTime(IngJulianSeconds As Long) As Date

'Julian Seconds plus 68 years to make compatible with Access
JulianSecondsToDateTime = DateAdd("yyyy", 68, CDate(IngJulianSeconds / 86400))

End Function

Is there a way to do so?




Keldair

Converting Julian Seconds with a macro to replace old seconds
 
Yes that helps, thank you much.

"Fred Smith" wrote:

One way to apply the same conversion as your Access function is:

=date(year(a1/86400)+68,month(a1/86400),day(a1/86400))

Does this help?

--
Regards,
Fred


"Keldair" wrote in message
...
I have just recently converted an access database to excel and in the data is
some fields with the date/time stored as julian seconds. In access I used to
just use a macro to convert and display it on a form, but I can no longer do
that.

I just wish to convert the data to a mm/dd/yyyy format, but I am unsure how
to with excel.

This is the function.

Function JulianSecondsToDateTime(IngJulianSeconds As Long) As Date

'Julian Seconds plus 68 years to make compatible with Access
JulianSecondsToDateTime = DateAdd("yyyy", 68, CDate(IngJulianSeconds / 86400))

End Function

Is there a way to do so?






All times are GMT +1. The time now is 11:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com