ASN.1 from ISO/IEC 8824 conform PDF Dates

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ASN.1 from ISO/IEC 8824 conform PDF Dates

Tobias van Treeck
Hi Jodaers,

i have a question regarding the formatting of a time.
The PDF standard defines two times in its metadata and the time is
according to ASN.1 definded ISO/IEC 8824.

It is basically in this format:
(D:YYYYMMDDHHmmSSOHH'mm')

Whereas everything from year to second is no problem, the last part is
the tricky one:

O is the relationship of local time to Universal Time (UT), denoted by
one of the characters +, −, or Z (see below)
HH followed by ' is the absolute value of the offset from UT in hours
(00–23)
mm followed by ' is the absolute value of the offset from UT in minutes
(00–59)

For exampe:

D:199812231952−08'00'

My problem is, that i can not format a time with joda time (at least not
easily) because of the time zone offset.
Joda offers three choices:

-0800 - if using 'Z'
-08:00 - if using 'ZZ'
America/Los_Angeles - if using 'ZZZ'

But how can i get −08'00' ??

Thanks
ToM



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ASN.1 from ISO/IEC 8824 conform PDF Dates

jodastephen
You need to manually implement DateTimePrinter to output the time zone
format you want. You can then integrate your class within a
DateTimeFormatterBuilder.

Stephen


2008/10/31 Tobias van Treeck <[hidden email]>:

> Hi Jodaers,
>
> i have a question regarding the formatting of a time.
> The PDF standard defines two times in its metadata and the time is
> according to ASN.1 definded ISO/IEC 8824.
>
> It is basically in this format:
> (D:YYYYMMDDHHmmSSOHH'mm')
>
> Whereas everything from year to second is no problem, the last part is
> the tricky one:
>
> O is the relationship of local time to Universal Time (UT), denoted by
> one of the characters +, −, or Z (see below)
> HH followed by ' is the absolute value of the offset from UT in hours
> (00–23)
> mm followed by ' is the absolute value of the offset from UT in minutes
> (00–59)
>
> For exampe:
>
> D:199812231952−08'00'
>
> My problem is, that i can not format a time with joda time (at least not
> easily) because of the time zone offset.
> Joda offers three choices:
>
> -0800 - if using 'Z'
> -08:00 - if using 'ZZ'
> America/Los_Angeles - if using 'ZZZ'
>
> But how can i get −08'00' ??
>
> Thanks
> ToM
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ASN.1 from ISO/IEC 8824 conform PDF Dates

Tobias van Treeck
Thanks for your reply.
I haven't implemented a DateTimePrinter yet, so i have some questions:

Do you mean i should implement a class like your TimeZoneOffset?
Do I also have to implement the DateTimeParser?

It seems to me a considerable amount of coding is necessary to reach the
goal... (a new class wich implements all methods of  DateTimePrinter,
DateTimeParser)
There is quite a bunch of methods - shouldn't it be possible to slightly
adapt one of your classes?
For instance introduce a 'ZZZZ' which prints out the necessary format?

Thanks,
ToM



> You need to manually implement DateTimePrinter to output the time zone
> format you want. You can then integrate your class within a
> DateTimeFormatterBuilder.
>
> Stephen
>
>
> 2008/10/31 Tobias van Treeck <[hidden email]>:
> > Hi Jodaers,
> >
> > i have a question regarding the formatting of a time.
> > The PDF standard defines two times in its metadata and the time is
> > according to ASN.1 definded ISO/IEC 8824.
> >
> > It is basically in this format:
> > (D:YYYYMMDDHHmmSSOHH'mm')
> >
> > Whereas everything from year to second is no problem, the last part
> > is
> > the tricky one:
> >
> > O is the relationship of local time to Universal Time (UT), denoted
> > by
> > one of the characters +, −, or Z (see below)
> > HH followed by ' is the absolute value of the offset from UT in
> > hours
> > (00–23)
> > mm followed by ' is the absolute value of the offset from UT in
> > minutes
> > (00–59)
> >
> > For exampe:
> >
> > D:199812231952−08'00'
> >
> > My problem is, that i can not format a time with joda time (at least
> > not
> > easily) because of the time zone offset.
> > Joda offers three choices:
> >
> > -0800 - if using 'Z'
> > -08:00 - if using 'ZZ'
> > America/Los_Angeles - if using 'ZZZ'
> >
> > But how can i get −08'00' ??
> >
> > Thanks
> > ToM
> >
> >
> >
> >
> > -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move Developer's
> > challenge
> > Build the coolest Linux based applications with Moblin SDK & win
> > great prizes
> > Grand prize is a trip for two to an Open Source event anywhere in
> > the world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > _______________________________________________
> > Joda-interest mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/joda-interest
> >
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ASN.1 from ISO/IEC 8824 conform PDF Dates

jodastephen
The class you need to implement is like the printer inner class within
DateTimeFormatterBuilder. Since this is the Apache 2 license, you can
start by working from that class.

You don't need to implement DateTimeParser unless you need a parser.

This is a special format, so I don't see us adding it to Joda-Time itself.

Stephen


Tobias van Treeck wrote:

> Thanks for your reply.
> I haven't implemented a DateTimePrinter yet, so i have some questions:
>
> Do you mean i should implement a class like your TimeZoneOffset?
> Do I also have to implement the DateTimeParser?
>
> It seems to me a considerable amount of coding is necessary to reach the
> goal... (a new class wich implements all methods of  DateTimePrinter,
> DateTimeParser)
> There is quite a bunch of methods - shouldn't it be possible to slightly
> adapt one of your classes?
> For instance introduce a 'ZZZZ' which prints out the necessary format?
>
> Thanks,
> ToM
>
>
>
>> You need to manually implement DateTimePrinter to output the time zone
>> format you want. You can then integrate your class within a
>> DateTimeFormatterBuilder.
>>
>> Stephen
>>
>>
>> 2008/10/31 Tobias van Treeck <[hidden email]>:
>>> Hi Jodaers,
>>>
>>> i have a question regarding the formatting of a time.
>>> The PDF standard defines two times in its metadata and the time is
>>> according to ASN.1 definded ISO/IEC 8824.
>>>
>>> It is basically in this format:
>>> (D:YYYYMMDDHHmmSSOHH'mm')
>>>
>>> Whereas everything from year to second is no problem, the last part
>>> is
>>> the tricky one:
>>>
>>> O is the relationship of local time to Universal Time (UT), denoted
>>> by
>>> one of the characters +, −, or Z (see below)
>>> HH followed by ' is the absolute value of the offset from UT in
>>> hours
>>> (00–23)
>>> mm followed by ' is the absolute value of the offset from UT in
>>> minutes
>>> (00–59)
>>>
>>> For exampe:
>>>
>>> D:199812231952−08'00'
>>>
>>> My problem is, that i can not format a time with joda time (at least
>>> not
>>> easily) because of the time zone offset.
>>> Joda offers three choices:
>>>
>>> -0800 - if using 'Z'
>>> -08:00 - if using 'ZZ'
>>> America/Los_Angeles - if using 'ZZZ'
>>>
>>> But how can i get −08'00' ??
>>>
>>> Thanks
>>> ToM
>>>
>>>
>>>
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win
>>> great prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in
>>> the world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> Joda-interest mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/joda-interest
>>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Joda-interest mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ASN.1 from ISO/IEC 8824 conform PDF Dates

Tobias van Treeck
Hi,

> The class you need to implement is like the printer inner class within
> DateTimeFormatterBuilder. Since this is the Apache 2 license, you can
> start by working from that class.
I couldn't find an innerclass called 'Printer' in the
DateTimeFormatterBuilder - so which did you mean?

> This is a special format, so I don't see us adding it to Joda-Time
> itself.
Adding convienience classes/methods for standardized PDF, XML etc.
timestamps is one thing (still nice to have though)
however shouldn't joda offer a all kinds of formatting options
(patterns) for a time?
So while i could get any format i want from era to millisecond
(separated by any character) - the formatting options are quite limited
regarding the timezone.
So it is not possible to differentiate between hour-timezoneoffset and
minute-timezoneoffset (which would solve the problem of getting
-08'00').

Joda now:
Z results in +0100;
ZZ results in  +01:00;
ZZZ Europe/Berlin


So what do i do if i want a different separation character than the
colon in the 'ZZ' pattern?
Here an option like ZH (zone hour) and Zm (Zone minute) would be very
helpful here because then the user has all options instead of three
predefined and fixed values.
(The ASN.1 date is not the only case where this kind of option is
helpul. For instance in some databases the timestamp has the format:
2007-03-08 16:12:01+01
- so in this case you just need the timezonehour. Others even have
timezoneseconds...)

This is no criticism - still really appreciate the work your doing with
joda - java time just sucks ;-)

Regards,
ToM

> Stephen
>
>
> Tobias van Treeck wrote:
> > Thanks for your reply.
> > I haven't implemented a DateTimePrinter yet, so i have some
> > questions:
> >
> > Do you mean i should implement a class like your TimeZoneOffset?
> > Do I also have to implement the DateTimeParser?
> >
> > It seems to me a considerable amount of coding is necessary to reach
> > the
> > goal... (a new class wich implements all methods of DateTimePrinter,
> > DateTimeParser)
> > There is quite a bunch of methods - shouldn't it be possible to
> > slightly
> > adapt one of your classes?
> > For instance introduce a 'ZZZZ' which prints out the necessary
> > format?
> >
> > Thanks,
> > ToM
> >
> >
> >
> >> You need to manually implement DateTimePrinter to output the time
> >> zone
> >> format you want. You can then integrate your class within a
> >> DateTimeFormatterBuilder.
> >>
> >> Stephen
> >>
> >>
> >> 2008/10/31 Tobias van Treeck <[hidden email]>:
> >>> Hi Jodaers,
> >>>
> >>> i have a question regarding the formatting of a time.
> >>> The PDF standard defines two times in its metadata and the time is
> >>> according to ASN.1 definded ISO/IEC 8824.
> >>>
> >>> It is basically in this format:
> >>> (D:YYYYMMDDHHmmSSOHH'mm')
> >>>
> >>> Whereas everything from year to second is no problem, the last
> >>> part
> >>> is
> >>> the tricky one:
> >>>
> >>> O is the relationship of local time to Universal Time (UT),
> >>> denoted
> >>> by
> >>> one of the characters +, −, or Z (see below)
> >>> HH followed by ' is the absolute value of the offset from UT in
> >>> hours
> >>> (00–23)
> >>> mm followed by ' is the absolute value of the offset from UT in
> >>> minutes
> >>> (00–59)
> >>>
> >>> For exampe:
> >>>
> >>> D:199812231952−08'00'
> >>>
> >>> My problem is, that i can not format a time with joda time (at
> >>> least
> >>> not
> >>> easily) because of the time zone offset.
> >>> Joda offers three choices:
> >>>
> >>> -0800 - if using 'Z'
> >>> -08:00 - if using 'ZZ'
> >>> America/Los_Angeles - if using 'ZZZ'
> >>>
> >>> But how can i get −08'00' ??
> >>>
> >>> Thanks
> >>> ToM
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> -------------------------------------------------------------------------
> >>> This SF.Net email is sponsored by the Moblin Your Move Developer's
> >>> challenge
> >>> Build the coolest Linux based applications with Moblin SDK & win
> >>> great prizes
> >>> Grand prize is a trip for two to an Open Source event anywhere in
> >>> the world
> >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >>> _______________________________________________
> >>> Joda-interest mailing list
> >>> [hidden email]
> >>> https://lists.sourceforge.net/lists/listinfo/joda-interest
> >>>
> >>
> >> -------------------------------------------------------------------------
> >> This SF.Net email is sponsored by the Moblin Your Move Developer's
> >> challenge
> >> Build the coolest Linux based applications with Moblin SDK & win
> >> great
> >> prizes
> >> Grand prize is a trip for two to an Open Source event anywhere in
> >> the
> >> world
> >> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >> _______________________________________________
> >> Joda-interest mailing list
> >> [hidden email]
> >> https://lists.sourceforge.net/lists/listinfo/joda-interest
> >
> >
> >
> > -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move Developer's
> > challenge
> > Build the coolest Linux based applications with Moblin SDK & win
> > great prizes
> > Grand prize is a trip for two to an Open Source event anywhere in
> > the world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > _______________________________________________
> > Joda-interest mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ASN.1 from ISO/IEC 8824 conform PDF Dates

jodastephen
2008/11/4 Tobias van Treeck <[hidden email]>:
> Here an option like ZH (zone hour) and Zm (Zone minute) would be very
> helpful here because then the user has all options instead of three
> predefined and fixed values.
> (The ASN.1 date is not the only case where this kind of option is
> helpul. For instance in some databases the timestamp has the format:
> 2007-03-08 16:12:01+01
> - so in this case you just need the timezonehour. Others even have
> timezoneseconds...)

This is an interesting use case, but not one I'm planning on tackling
for Joda-Time. I might consider it for JSR-310, but it does get a
little tricky (its like another date-time field I suppose).

Stephen

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Loading...