Convert between world time zones with daylight saving times

버전 1.1.0.0 (5.38 KB) 작성자: Erwin Mayer
This is a very simple yet powerful function to convert a datenum from one timezone to another.
다운로드 수: 2.3K
업데이트 날짜: 2014/12/16

라이선스 보기

Update (2014-12-16): I now greatly recommend to use the Joda Time library instead of this function:
http://joda-time.sourceforge.net/
I have been using the C# port Noda Time lately and it is perfectly suited for this kind of tasks.
-----------------
As I could find no built-in function nor reliable contribution to achieve that, I had no choice but to write my own, leveraging the GregorianCalendar Java class.
Usage is quite simple:
targetDST = TimezoneConvert( dn, fromTimezone, toTimezone )
The datenum dn corresponds to the datetime you want to convert. Just specify from which timezone it comes and the target timezone, and you should get the expected result, that takes into account daylight saving time.

Feel free to let me know if I can extend it to support more situations (like Julian Calendar, obviously ;-).

You can get the name of the available timezones using this command:
TimeZone.getAvailableIDs
after importing the relevant java packages.
import java.lang.String
import java.util.* java.awt.*
import java.util.Enumeration

인용 양식

Erwin Mayer (2024). Convert between world time zones with daylight saving times (https://www.mathworks.com/matlabcentral/fileexchange/27953-convert-between-world-time-zones-with-daylight-saving-times), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2007a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.1.0.0

Update (2014-12-16): I now greatly recommend to use the Joda Time library instead of this function:
http://joda-time.sourceforge.net/
I have been using the C# port Noda Time lately and it is perfectly suited for this kind of tasks.

1.0.0.0