Re: Fecha con MSSQL 7

From: Date: Tue, 01 Apr 2003 13:13:10 +0000
Subject: Re: Fecha con MSSQL 7
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-34506@lists.php.net to get a copy of this message
Podrias usar algo parecido ha esto SELECT DATE_FORMAT(Nombre_del_campo,'%Y-%m') WHERE DATE_FORMAT(Nombre_del_campo,'%Y-%m') ='2003-03' FROM nombre_de_tabla en este SELECT le digo que me debuelva el campo en format '2003-04' para el mes actual. Para agregar el dia creo que hace falta poner %d, tene cuidado de poner en mayusculas y minusculas tal como te lo escribo.Ahorita te busco la referencia para el DATE_FORMAT: mira este ejemplo: $query = "select * , date_format(created,’%e %M, %Y %h:%i %p’) as entry_date from guestbook order by created desc limit $offset, " . PAGE_LIMIT ; $result = safe_query($query); AQUI TE VA LA REFERENCIA COMPLETA: Specifier, Meaning %M, Month name (Januarythrough December) %W, Weekday name (Sundaythrough Saturday) %D, Day of the month with English suffix (1st, 2nd, 3rd, etc.) %Y Year, numeric, four digits %y Year, numeric, two digits %a Abbreviated weekday name (Sun..Sat) %d Day of the month, numeric (00..31) %e Day of the month, numeric (0..31) %m Month, numeric (01..12) %c Month, numeric (1..12) %b Abbreviated month name (Jan..Dec) %j Day of year (001..366) %H Hour (00..23) %k Hour (0..23) %h Hour (01..12) %I Hour (01..12) %l Hour (1..12) %i Minutes, numeric (00..59) %r Time, 12-hour (hh:mm:ss [AP]M) %T Time, 24-hour (hh:mm:ss) %S Seconds (00..59) %s Seconds (00..59) %p AM or PM %w Day of the week (0=Sunday..6=Saturday) %U Week (0..53), where Sunday is the first day of the week %u Week (0..53), where Monday is the first day of the week Fran <franciscojose@tesipro.com> wrote:Hola listeros,mi problema es el siguiente: Tengo una BD en SQL Server 7 con campos DATE del estilo 01/01/2003, al hacer una consulta con PHP y al extraer los campos utilizando ADODB me devuelve todos estos campos cambiandome la forma a 1 ene de 2003. Revise la configuración de Windows para la fecha y la hora pero no consigo que me la devuelva tal y como la guardo en la BD. Alguien me podria ayudar please?? Gracias de antemano. --------------------------------------------------------------------- Archivo On-line: http://www.phpes.com/ via news: news://news.phpes.com/ Manual PHP en español: http://www.php.net/manual/es/ Para dar de baja la suscripción, mande un mensaje a: lista-unsubscribe@phpes.com --------------------------------- Do You Yahoo!? Todo lo que quieres saber de Estados Unidos, América Latina y el resto del Mundo. Visíta Yahoo! Noticias.

« previous php.general.es (#34506) next »