Function Help - take UTC time and make it local automaticaly

ajscott911

New Member
Joined
Sep 19, 2006
Messages
20
here's the last issue I'm hoping someone will have an answer for.

in Javascript DateVar.setUTCFullYear(*datecoding*) will set the DateVar to the current users time {based on the users time zone} assuming that *datecoding* is the current time UTC ((IE. if it were noon UTC time it would be 7am Eastern time because Eastern time is -5 hours behind UTC))

Is there a way to do the same thing in VBA without making your own function or barring that, what would an appropriate function look like? I'm trying to make this all automatic without any input from the user telling the function which timezone they are in.

if someone could come up with a custom function that took in an UTC date and fed out a converted time to the users current time zone it would be very helpful.

Adam
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
I may be missing the point, as most folkf tend to have their PC time set to local, the =NOW() function should work.
It will display the date and time by default, you may need to change the number format to (custom) hh:mm:ss

The drawback is that it only updates when another calculation takes place... i.e. if you open the workbook at 19:22pm then that is what the function will tell you, even 5 minutes later unless the book or sheet is changed (with a calculation).

You could create a timer using VBA but it would need to refresh every second or minute etc
 
Upvote 0

Forum statistics

Threads
1,214,627
Messages
6,120,610
Members
448,973
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top