convertir qm fecha a php

55 views
Skip to first unread message

Javsolis3

unread,
Oct 10, 2012, 5:55:30 PM10/10/12
to openqm-o...@googlegroups.com
qm tiene 5 digitos como convierto eso 5 digitos a fecha a ver si alguien sabe la formula

ejemplo

fecha en qm = 16297   # esto es una fecha guardada en qm

quiero que me de en php la fecha!!!

geneb

unread,
Oct 10, 2012, 8:40:00 PM10/10/12
to openqm-o...@googlegroups.com
If memory serves, Pick dates are the number of days since December 31,
1967.

g.

--
Proud owner of F-15C 80-0007
http://www.f15sim.com - The only one of its kind.
http://www.diy-cockpits.org/coll - Go Collimated or Go Home.
Some people collect things for a hobby. Geeks collect hobbies.

ScarletDME - The red hot Data Management Environment
A Multi-Value database for the masses, not the classes.
http://www.scarletdme.org - Get it _today_!

Javsolis3

unread,
Oct 11, 2012, 10:12:21 AM10/11/12
to openqm-o...@googlegroups.com
ok but as a friend if I make it into php use the command "date" as you would for qm. This conversion takes me two months already and I do not get.

Javsolis3

unread,
Oct 11, 2012, 10:13:13 AM10/11/12
to openqm-o...@googlegroups.com

geneb

unread,
Oct 11, 2012, 10:21:16 AM10/11/12
to openqm-o...@googlegroups.com
On Thu, 11 Oct 2012, Javsolis3 wrote:

> ok but as a friend if I make it into php use the command "date" as you
> would for qm. This conversion takes me two months already and I do not get.
>

Internal Pick dates are the number of days starting from December 31st,
1967. 12/31/67 is 0. Today (10/11/12) is 16356. You need to create a
routine in php that will make this conversion.

Javsolis3

unread,
Oct 11, 2012, 10:40:09 AM10/11/12
to openqm-o...@googlegroups.com
  1. if ($fecha == NULL) {
  2. $file_fech = qmopen("ARCH.FECHA");
  3. $regfech = qmread($file_fech,'VT');
  4. $campo_fech   = explode("þ", $regfech);
  5. $fecha = $campo_fech[0];
  6. $hora = $campo_fech[2];
  7. $fecha_final = $fecha.$hora;
  8.  
  9. $fecha = date ("d-M-Y", $fecha_final);


el me arroja la fecha del 01-Oct-2021 y me debe arrojar la actual a ver si me dan la manito con esto
si necesitan mas info me comunican vale gracias !!!

Javsolis3

unread,
Oct 11, 2012, 10:44:50 AM10/11/12
to openqm-o...@googlegroups.com
  1. if ($fecha == NULL) {
  2. $file_fech = qmopen("ARCH.FECHA");
  3. $regfech = qmread($file_fech,'VT');
  4. $campo_fech   = explode("þ", $regfech);
  5. $fecha = $campo_fech[0];
  1. #$hora = $campo_fech[2];
  2. $fecha_final = $fecha.$hora;
  3.  
  4. $fecha = $fecha_final;


Como pueden notar comente la variable $hora ya que la variable $fecha me arroja el numero de la base de datos que esta en entero me pregunto como lo transformo si lo dejo asi me imprime 16330 solo quiero que me imprima la fecha de ese entero

si hago esto tampoco:

  1. <?php
  2. echo date('Y-m-d H:i:s', 16330);
  3. ?>

no hace nada?



geneb

unread,
Oct 11, 2012, 11:11:19 AM10/11/12
to openqm-o...@googlegroups.com
On Thu, 11 Oct 2012, Javsolis3 wrote:

>
>
> 1. if ($fecha == NULL) {
> 2. $file_fech = qmopen("ARCH.FECHA");
> 3. $regfech = qmread($file_fech,'VT');
> 4. $campo_fech = explode <http://www.php.net/explode>("�", $regfech);
> 5. $fecha = $campo_fech[0];
> 6. $hora = $campo_fech[2];
> 7. $fecha_final = $fecha.$hora;
> 8.
> 9. $fecha = date <http://www.php.net/date> ("d-M-Y", $fecha_final);
>
>
> el me arroja la fecha del 01-Oct-2021 y me debe arrojar la actual a ver si
> me dan la manito con esto
> si necesitan mas info me comunican vale gracias !!!

If you don't want to write the routine in PHP to do the date conversion, I
would create a subroutine on the host side and call it with the QMCall()
routine.

For example, you could create this BASIC routine:

subroutine conv.qmcall(type, inval, conversion, outval)
begin case
case type = "I"
outval = iconv(inval, conversion)
case type = "O"
outval = oconv(inval, conversion)
case 1
outval = "INVALID CONVERSION"
end case
return

Compile & catalog and then call it like so:
qmcall("conv.qmcall", 4, "O", $pick_date, "D2-", $php_date);

BTW, where did you get the php library? I didn't know one was available.
:)

Javsolis3

unread,
Oct 11, 2012, 11:27:59 AM10/11/12
to openqm-o...@googlegroups.com
acabo de ver una formula voy a probarla luego les comento como me fue

Javsolis3

unread,
Oct 11, 2012, 11:34:22 AM10/11/12
to openqm-o...@googlegroups.com
la bilbioteca la consegui en la pagina de openqm amigo.
Reply all
Reply to author
Forward
0 new messages