←Select platform

TimeZoneOffset Method

Summary

Extracts the time zone information from the PDF date string returned by the CreatedOriginal or ModifiedOriginal properties.

Syntax

C#
C++/CLI
Java
Python
public static string TimeZoneOffset( 
   string originalTime 
) 
public String TimeZoneOffset( 
   java.lang.String originalTime 
); 
public: 
String^ TimeZoneOffset(String^ originalTime); 
def TimeZoneOffset(self,originalTime): 

Parameters

originalTime

The string containing the time in PDF time format

Return Value

The time offset formatted as a string in one of the following forms:

" (empty string) if the time did not contain time zone information
UTC if the time was UTC
+HH:mm if the time zone is UTC+HH:mm
-HH:mm if the time zone is UTC-HH:mm

Remarks

The originalFormat parameter should be a valid PDF string as returned by the CreatedOriginal or ModifiedOriginal properties. See the CreatedOriginal property for a description of the format expected for the originalFormat parameter. If the string is invalid, this method will throw an exception.

Example

C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Pdf; 
using Leadtools.Svg; 
using Leadtools.WinForms; 
 
 
 
public void TestPDFTime() 
{ 
   string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf"); 
   PDFFile pdfFile = new PDFFile(pdfFileName); 
   pdfFile.Load(); 
 
   PDFDocumentProperties properties = pdfFile.DocumentProperties; 
   Console.WriteLine("Created = {0}", properties.Created.ToString()); 
   Console.WriteLine("Modified = {0}", properties.Modified.ToString()); 
   Console.WriteLine("CreatedOriginal = {0}", properties.CreatedOriginal); 
   Console.WriteLine("ModifiedOriginal = {0}", properties.ModifiedOriginal); 
   Console.WriteLine("CreatedTimeZoneOffset = {0}", PDFDocumentProperties.TimeZoneOffset(properties.CreatedOriginal)); 
   Console.WriteLine("ModifiedTimeZoneOffset = {0}", PDFDocumentProperties.TimeZoneOffset(properties.ModifiedOriginal)); 
} 
 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.BufferedWriter; 
import java.io.Console; 
import java.io.File; 
import java.io.FileWriter; 
import java.io.IOException; 
import java.io.OutputStream; 
import java.io.OutputStreamWriter; 
import java.nio.Buffer; 
import java.nio.file.Files; 
import java.nio.file.Path; 
import java.nio.file.Paths; 
import java.nio.file.StandardOpenOption; 
import java.sql.Date; 
import java.text.SimpleDateFormat; 
import java.time.LocalDateTime; 
import java.util.ArrayList; 
import java.util.List; 
 
import javax.xml.validation.Schema; 
 
import org.apache.lucene.store.Directory; 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.barcode.*; 
import leadtools.codecs.*; 
import leadtools.pdf.*; 
import leadtools.svg.*; 
 
 
public void testPDFTimeExample() { 
 
   String LEAD_VARS_ImagesDir = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String pdfFileName = combine(LEAD_VARS_ImagesDir, "Leadtools.pdf"); 
   PDFFile pdfFile = new PDFFile(pdfFileName); 
   pdfFile.load(); 
 
   PDFDocumentProperties properties = pdfFile.getDocumentProperties(); 
   System.out.println("Created = " + properties.getCreated().toString()); 
   System.out.println("Modified = " + properties.getModified().toString()); 
   System.out.println("CreatedOriginal = " + properties.getCreatedOriginal()); 
   System.out.println("ModifiedOriginal = " + properties.getModifiedOriginal()); 
   System.out.println("CreatedTimeZoneOffset = " + 
         PDFDocumentProperties.timeZoneOffset(properties.getCreatedOriginal())); 
   System.out.println("ModifiedTimeZoneOffset = " + 
         PDFDocumentProperties.timeZoneOffset(properties.getModifiedOriginal())); 
} 

Requirements

Target Platforms

See Also

PDFDocumentProperties Class

PDFDocumentProperties Members

PDFDocumentProperties.CreatedOriginal property

PDFDocumentProperties.ModifiedOriginal property

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Pdf Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.