Según el manual de SQL, hay 2 funciones escalares para recuperar el
día de la semana:
DAYOFWEEK_ISO:
The DAYOFWEEK_ISO function returns an integer between 1
and 7 that represents the day of the week, where 1 is Monday and 7 is
Sunday.
DAYOFWEEK:
The DAYOFWEEK function returns an integer between 1 and
7 that represents the day of the week, where 1 is Sunday and 7 is
Saturday.
Luego uses la función que uses, siempre te dará el mismo resultado,
independientemente del país, idioma o configuración que tenga el AS.
Potele
El 20/07/2016 7:41, alberto escribió:
Gracias Jesus.
La rutina ya la tengo, lo que tenía
era la duda de si me puedo encontrar como primer dia el *mon o el
*sun(dependiendo
de en qué AS se ejecute), y si forzando a que un dia siempre sea el
primero,
aseguro la jugada.
De:
Jesus Olague
<[email protected]>
Para:
"forum.help400"
<[email protected]>
Fecha:
19/07/2016 19:27
Asunto:
Re: QDayofweek
Enviado por:
[email protected]
Recuerdo que se podía obtener con un API o mediante
SQL,
o calcularse por programa.
Con API
QWCRSVAL (solo para la fecha actual)
Con SQL:
select dayofweek_ISO(fecha) from archivo
Con SQL embebido:
Exec SQL Set :DiaSemana =
DayOfWeek_ISO(:Fecha);
Dsply DiaSemana;
Calculado (tenía este ejemplo guardado, no recuerdo si
alguna vez lo probé):
**************************************************************************
* Return Day of Week - Use Zeller's congruence
* Returns an integer with the day number
of the year
* 0 = Monday, 1 = Tuesday 2 = Wednesday,
etc.
**************************************************************************
P getDayOfWeek B
Export
D getDayOfWeek PI
10i 0
D InDate
d const datfmt(*iso)
*
D nDay s
10i 0
D nMonth s
10i 0
D nYear s
10i 0
D nDayOfWeek s
10i 0
*
/free
nDay = %subdt(InDate:*days);
nMonth = %subdt(InDate:*months);
nYear = %subdt(InDate:*years);
if nMonth < 3;
nMonth = nMonth + 12;
nYear = nYear - 1;
endif;
nDayOfWeek = %rem(%int((13 * nMonth
+ 3) / 5) + nDay + nYear +
%int(nYear / 4) - %int(nYear / 100) +
%int(nYear / 400) : 7);
return nDayOfWeek;
/end-free
P getDayOfWeek E
--
Saludos
Jesús Olague
Zacatecas, México
http://jholaguepersonal.blogspot.com
2016-07-19 10:17 GMT-05:00 alberto <[email protected]>:
Hola Foro
Cómo puedo hacer para que en el Qdayofweek me salga el lunes como
primer
dia de la semana, y no el domingo como sale por defecto?
Gracias!
____________________________________________________
Únete a Recursos AS400, nuestra Comunidad ( http://bit.ly/db68dd
)
Forum.Help400 © Publicaciones Help400, S.L.
____________________________________________________
Únete a Recursos AS400, nuestra Comunidad ( http://bit.ly/db68dd
)
Forum.Help400 © Publicaciones Help400, S.L.
____________________________________________________
Únete a Recursos AS400, nuestra Comunidad ( http://bit.ly/db68dd )
Forum.Help400 © Publicaciones Help400, S.L.
José de la Herran Núñez
Kordinazio Teknikoko Burua Jefe del Área de Coordinación Técnica
Ayuntamiento de Vitoria-Gasteiz
Informazioaren Teknologien Saila Departamento de Tecnologías de la Información
Tel: work945161614 | Fax fax945161600
[email protected] | www.vitoria-gasteiz.org
KONFIDENTZIALTASUNA
Komunikazio honen edukia eta honi erantsitako dokumentazio osoarena konfidentziala da eta adierazitako jasotzaileari beste inori ez dagokio.
Zeu jasotzaile ez bazina, jakinaraz iezaguzu, mesedez, eta eskatu nahi dizugu edukiaren berri inori ez esan eta mezua ezaba dezazula.
CONFIDENCIALIDAD
El contenido de esta comunicación, así como el de toda la
documentación anexa, es confidencial y va dirigido
únicamente al destinatario del mismo.
En el supuesto de que usted no fuera el destinatario, le solicitamos
que nos lo indique y no comunique su contenido a terceros, procediendo
a su destrucción.
CONFIDENCIALITY
The content of this communication and any attached information is confidential and exclusively for the use of the addressee.
If you are not the addressee, we ask you to notify to the sender and do not pass its content to another person, and please be sure you destroy it.
|