• Publicidad

Comparar fechas

¿Ya sabes lo que es una referencia? Has progresado, el nível básico es cosa del pasado y ahora estás listo para el siguiente nivel.

Re: Comparar fechas

Notapor gema258 » 2013-01-21 06:20 @306

¡Solucionado! De hecho, sí que dependía de los directorios...

Muchas gracias, ¡muy, muy buena web!
gema258
Perlero nuevo
Perlero nuevo
 
Mensajes: 3
Registrado: 2013-01-18 14:24 @642

Publicidad

Re: Comparar fechas

Notapor explorer » 2013-01-21 15:34 @690

¿Sólo 281 paquetes? Ese debe ser el número de paquetes que trae ActiveState por defecto.

Por favor, repasa la parte 3.3 de la guía del PPM que te enlacé, para agregar el repositorio de trouchelle.

Si a la hora de instalar el módulo, lo ha hecho en algún directorio extraño, se puede indicar dentro del programa con 'use lib ...'.
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14475
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Re: Comparar fechas

Notapor ealfaro » 2013-05-20 10:10 @465

Hola a todos.

Estoy intentado utilizar el módulo DateTime::Format::Strptime como usáis aquí.

Funciona correctamente mi script, pero al lanzarlo muestra una serie de mensajes en la consola diciendo que el módulo DateTime::Locale::Base está obsoleto.

¿Qué es lo que ocurre? Estos son los mensajes:
The am_pms method in DateTime::Locale::Base has been deprecated. Please see the DateTime::Locale distribution's Changes file for details at /usr/share/perl5/DateTime/Format/Strptime.pm line 610
The default_date_format method in DateTime::Locale::Base has been deprecated. Please see the DateTime::Locale distribution's Changes file for details at /usr/share/perl5/DateTime/Format/Strptime.pm line 613
The default_time_format method in DateTime::Locale::Base has been deprecated. Please see the DateTime::Locale distribution's Changes file for details at /usr/share/perl5/DateTime/Format/Strptime.pm line 617
The default_datetime_format method in DateTime::Locale::Base has been deprecated. Please see the DateTime::Locale distribution's Changes file for details at /usr/share/perl5/DateTime/Format/Strptime.pm line 621
The day_names method in DateTime::Locale::Base has been deprecated. Please see the DateTime::Locale distribution's Changes file for details at /usr/share/perl5/DateTime/Format/Strptime.pm line 671
The day_abbreviations method in DateTime::Locale::Base has been deprecated. Please see the DateTime::Locale distribution's Changes file for details at /usr/share/perl5/DateTime/Format/Strptime.pm line 671
The month_names method in DateTime::Locale::Base has been deprecated. Please see the DateTime::Locale distribution's Changes file for details at /usr/share/perl5/DateTime/Format/Strptime.pm line 682
The month_abbreviations method in DateTime::Locale::Base has been deprecated. Please see the DateTime::Locale distribution's Changes file for details at /usr/share/perl5/DateTime/Format/Strptime.pm line 682
The am_pms method in DateTime::Locale::Base has been deprecated. Please see the DateTime::Locale distribution's Changes file for details at /usr/share/perl5/DateTime/Format/Strptime.pm line 469
The am_pms method in DateTime::Locale::Base has been deprecated. Please see the DateTime::Locale distribution's Changes file for details at /usr/share/perl5/DateTime/Format/Strptime.pm line 469
ealfaro
Perlero nuevo
Perlero nuevo
 
Mensajes: 1
Registrado: 2013-05-20 10:02 @459

Re: Comparar fechas

Notapor explorer » 2013-06-19 12:37 @567

Bienvenido a los foros de Perl en Español, ealfaro.

Pues lo que me parece que tienes una familia de módulos DateTime muy viejita... El archivo de cambios dice que esos métodos que está intentando usar StrpTime, desaparecieron en el 2009...

Prueba a actualizarlos...
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14475
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Re: Comparar fechas

Notapor coltx » 2016-03-28 13:13 @592

explorer, sobre este mismo ejemplo, ¿se podría utilizar para realizar la comparación de dos fechas pero con hora incluida? Por ejemplo:

Fecha 1 : 2016-03-28 10:01:10
Fecha 2 : 2016-04-10 23:13:02
coltx
Perlero nuevo
Perlero nuevo
 
Mensajes: 79
Registrado: 2011-09-16 08:01 @376

Re: Comparar fechas

Notapor coltx » 2016-03-28 16:06 @712

Ya lo encontré, me respondo solo... ¡jajajaja!
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1.         my $Strp = new DateTime::Format::Strptime(pattern=>'%Y-%m-%d %H:%M:%S');
  2.  
  3.         my $dt_fecha1 = $Strp->parse_datetime( $Fecha1 );
  4.         my $dt_fecha2 = $Strp->parse_datetime( $Fecha2 );
  5.  
  6.         my $cmp = DateTime->compare($dt_fecha1, $dt_fecha2);
Coloreado en 0.003 segundos, usando GeSHi 1.0.8.4
coltx
Perlero nuevo
Perlero nuevo
 
Mensajes: 79
Registrado: 2011-09-16 08:01 @376

Anterior

Volver a Intermedio

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 1 invitado

cron