Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the TimeZone of a remote machine

 
Manish Ramrakhiani
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I just have the name/IP of some remote machine and want to know the time zone of the same.

Please let me know how this can be done in Java.

Thanks,
Manish Ramrakhiani.
 
Dawn Charangat
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think you can do this in plain Java without any agent running in the remote system.

1. if the system is unix based, write a script (in the remote machine) which will return the time zone, and execute this script remotely using Java/SSH/SCP API.
2. same in windows, but instead of *.sh, you might want to look for a *.bat file or see if there are any MFC components that is available which can return the time zone.
3. if there is an SNMP agent running int he remote machine, you can try getting the data from the SNMP MIB as well (you might want to check out some SNMP libraries like the westhawk stack or snmp4j)

Hope this helps...
 
Manish Ramrakhiani
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dawn,
I will see what is feasible for me.

Thanks,
Manish Ramrakhiani.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic