Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Description

Thai

ลักษณะ

  • org.joget.commons.util.TimeZoneUtil
  • Under wflow-commons module
  • Utility methods to deal with Time Zone

Code Sample

Thai

ตัวอย่างโค้ด

Code Block
languagejava
import java.util.Date;
import org.joget.commons.util.TimeZoneUtil;
import org.joget.apps.app.service.AppUtil;
 
//Format current date to System/User selected timezone and date format
String dateString = TimeZoneUtil.convertToTimeZone(new Date(), null, AppUtil.getAppDateFormat());

Methods

Thai

กระบวนการ

convertToTimeZone
public static java.lang.String convertToTimeZone(java.lang.Date time, java.lang.String gmt, java.lang.String format) 

...

format - follow java.text.SimpleDateFormat syntax.

Thai

แปลงวันที่เป็นสตริงตาม GMT / Timezone ID และรูปแบบวันที่

พารามิเตอร์:

gmt - GMT ("-12" ถึง "12") หรือ ID เขตเวลา, NULL เพื่อใช้เขตเวลา / ระบบที่ผู้ใช้เลือก

รูปแบบ - ติดตาม java.text.SimpleDateFormat ไวยากรณ์

getList
public static java.util.Map<java.lang.String, java.lang.String> getList()

...

Return a map of time zone id and its description

Thai

ดึงรายการของเขตเวลา

ส่งคืนแผนที่ของรหัสเขตเวลาและคำอธิบาย

getServerTimeZone
public static java.lang.String getServerTimeZone()
English
Retrieve Server Time Zone in GMT format
Thai

ดึงเขตเวลาของเซิร์ฟเวอร์ในรูปแบบ GMT

getServerTimeZoneID
public static java.lang.String getServerTimeZoneID()

Retrieve Server Time Zone ID 

Thai

ดึง ID เขตเวลาของเซิร์ฟเวอร์

getTimeZoneByGMT
public static java.lang.String getTimeZoneByGMT(java.lang.String gmt)

Get Time Zone ID by GMT 

Thai

...

รับรหัสเขตเวลาตาม GMT