These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

pdf date format to GMT date format

lucianopilla
Registered: Oct 18 2007
Posts: 76

Hello,
i want to convert a PDF date format (ex. D:20080428123656 tagged by 0) to a GMT without hours/minutes/second (28/04/2008 tagged by 2).
I tried cFormat String Pattern but i failed with it. could i have some suggest about?

Adding intelligence to documents

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
The current ISO time standard is "UTC", Universal Time Coordinated, not GMT, Greenwich Mean Time. This is the date and time at the Royal Naval Observatory at Greenwich, England. Local time is then obtained by applying the appropriate time zone offset from the UTC value.

To get the UTC date one can obtain the JavaScript date time object then use the JavaScript method "toUTCString()" to get the local date time object to the UTC date time string. Now one can use some of the other Date object methods to get the full year, month and date values which can then be combined into a string for the local time zone or the UTC time zone.

console.show();
console.clear();
var LocalCurrDate = new Date(); // get the local date time sting
// display some information:
console.println("Local date time: " + LocalCurrDate);
// get some local date information
var LocalYear = LocalCurrDate.getFullYear(); // get 4 digit year
var LocalMonth = LocalCurrDate.getMonth() + 1; // get month and adjust for zero based value
var LocalDate = LocalCurrDate.getDate(); // get date of month
// format the local date items as desired
console.println("Local current date (\" DD/MM/yyyy\"): " + LocalDate + "/" + LocalMonth + "/" + LocalYear);
// to get the local time zone offset:
console.println("Local time zone offset in minutes: " + LocalCurrDate.getTimezoneOffset());
console.println("Local time zone offset in hours: " + (LocalCurrDate.getTimezoneOffset() / 60));

// get some UTC date information based on the local machine time zone
var UTCCurrDate = LocalCurrDate.toUTCString(); // convert to UTC string
console.println("UTC date time: " + UTCCurrDate);
var UTCYear = LocalCurrDate.getUTCFullYear(); // get the UTC full year from the local time
var UTCMonth = LocalCurrDate.getUTCMonth(); // get the UTC month from the local time
var UTCDate = LocalCurrDate.getUTCDate(); // get the UTC date of the month from the local time
// format the UTC date items as desired
console.println("UTC current date (\" DD/MM/yyyy\"): " + UTCDate + "/" + UTCMonth + "/" + UTCYear);

George Kaiser