Re: [PhP - dB] About Formatting a Date Result



you have to correctt the way the data is entered into your table so that it
is not a formatted string
and do an update on the table to alter the stored data to a timestamp with
the same value

--
_ _
"Moose" <1911@xxxxxxxxxxx> wrote in message
news:280120090647118269%1911@xxxxxxxxxxxxxx
Hi almostbob, thanks for the input.
In the MySQL database the field is set to date not timestamp as you
stated. I did change the field to timestamp but now my output is
exactly date(j-m-Y, %s), which displays as:

date(j-m-Y,1999-01-01 00:00:00

Now What?

Thanks
Mike




In article <jR%el.7669$Db2.1059@edtnps83>, almostbob
<anonymous1@xxxxxxxxxxxxx> wrote:

what you are getting is an unformatted string, directly out of the
database
in the sql query that creates the table row it appears some severe lack
of
foresight has stored a string date instead of a timestamp,
if the timestamp were stored then date comparison is easier, select a
range
of dates by simply numeric values,
output is easier, can be formatted to different user requirements even
while
the information is displayed
the database is slightly smaller and faster, int compared to a text
field.
and can format your date to that used, in the config files, for any user
redesign the database and the sql input at this early stage and less
problems later,
the output field can then be
<td>date(j-m-Y, %s)</td>

I have chosen 31d-12m-1999y, thats the way my calendar works, the date
strings are in the php online manual.


.



Relevant Pages

  • Re: [PHP] Date/time format?
    ... Jason Pruim wrote: ... I am trying to figure out what format a string is in in a database. ... Below is an example of one of the lines in the database, What I'm really interested in is how it represents the "day". ... I have not been able to find ANY info about that format, other then other people using it in blogs. ...
    (php.general)
  • Re: year to date conversion
    ... the date in ISO-format, i.e. exactly in the format the OP requested. ... It is rare to need to be database independent. ... Sure, but again, there are moments, where a PreparedStatement ... The string is created by java.sql.Date, ...
    (comp.lang.java.programmer)
  • Re: Getting entries from an SQL database with datetime parameter
    ... format is what you want. ... funtion to convert date string into date time accordig to your needs. ... your database, you will run into troubles comparing date to string. ... > hard coded a query to populate the datagrid, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How to represent variable data types?
    ... double, integer, string, and timestamp. ... don't know the data type we're looking for. ... I'm working on refactoring the database this week, ...
    (comp.databases)
  • Re: Manipulation of strings query
    ... I have received the data in an excel spreadsheet which contains the names in ... that I could enter it as 2 fields in a database and I'm certainly not doint ... The problem with the string input is that users will not be entering the ... > cintains names in the format LASTNAME, ...
    (microsoft.public.inetserver.asp.general)