On 6 Apr 2004, at 16:23, Claude wrote:


"Graham" == Graham Barr <[EMAIL PROTECTED]> writes:
[...]

25/Mar/2004:13:02:31 -0200

Can I convert this date to the "Generalized Time" format using the
convert::ASN1 module?

Graham> Try Date::Parse to turn this into a unixtime value, then Date::Format
Graham> to convert that into the string format you want.


Many Tx again to your good work and advice: it worked in 5 min:

  use Date::Parse;
  use Date::Format;

  my $date1 = "25/Mar/2004:13:02:31 -0200";
  my $template = "%Y%m%d%k%M%S";

my $time = str2time($date1);

  # generalized time from ASN.1 X.208
  my $gt = time2str($template, $time);

  print "- date1 = $date1\n";
  print "- time = $time\n";
  print "- Generalized time = $gt" . "Z\n";

Why not put the Z in $template ?


my $template = "%Y%m%d%k%M%SZ";

should work just fine

Graham.


Well, ok, I admit: the "Z" in the end needs some improvement... -- Claude




Reply via email to