Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Converting Date Formats?


I have some dates in a MySQL database that are in a 'Y-m-d' format.
Is there a way to have PHP read these dates and convert them to a
'd-M-Y' format?




View Complete Forum Thread with Replies

Related Forum Messages:
Php Converting File Formats
if its possible to convert documents through the web....IE- word docs to a pdf, pdf to word docs, image files to pdf, powerpoint to pdf,

View Replies !
Converting Audio Formats
I would like to allow my users to upload a large wav file and have it converted to one of the following: a smaller wav file, an MP3, RA or WMA.

My users have access to only large files, and it is not an option to ask them to do the converting on their own.

I've done a little research, but can't seem to find anything on this. Can PHP do this. Should I have PHP call an outside program? which one? how? My server's OS is XP.

View Replies !
Date Formats
I looked at this a while ago (Nov 23). I have a mySQL database with a date entered field, and am just trying to display it more sensibly in the web pages. Code:

View Replies !
Date Formats For Locale
I have a server app which is sent a date in the local format of the client
machine. I've no control over the client app at all, so have to code at the
server end to cope with any problems. The server is in the US, so any
dates need to be in US format before they will convert using strtotime()

Here is what i'm doing at the moment..

// need to convert date to use USA mm/dd/yyyy format on server
$split = explode(",",$_SERVER[HTTP_ACCEPT_LANGUAGE]);

switch ($split[0]) {
case "en-us":
break;
case "en-gb":
$lt = substr($lt,3,3) . substr($lt,0,3) . substr($lt,6);
break;
case "da":
case "pt":
$lt = substr($lt,3,2) . "/" . substr($lt,0,2) . "/" . substr($lt,6);
break;
}
$ustime = strtotime($lt);

View Replies !
Date Field And Formats
I have been looign at and wonder...

what is the easiest way to check a date field and transfer it into:
dd.mm.yyyy ?

Eventually I would like to accept dd.mm then yyyy is present year (unless month < now, then yyyy++ ). The basic thing is to format the date as dd.mm.yyyy - how?

View Replies !
PHP Date Formats And MySQL
I've read that it's best to store your dates in the Unix Timestamp format using the strtotime($date) command (read here).  How should I best setup the field in my MySQL table? Should I use a VARCHAR, and if so how big?

View Replies !
Date Formats Problem
I am having a small problem, I am entering the date to mysql database as date('F j, Y, g:i a') but in string format. The database field type for date is varchar(255).Now I want to search from a particular date(mm/dd/yyyy) to a particular date(mm/dd/yyyy), how will I do that? let me explain again

Enter to mysql
$enterdate=date('F j, Y, g:i a');
insert into datetable(DateFLD, NameFLD) values ($enterdate,'$_POST[FirstName]');
Here the field DateFLD is varchar(255)type.

Problem
Search between mm/dd/yyyy and mm/dd/yyyy

View Replies !
Simple Date Question (Changing Formats)
In my MySQL table I have a date-type column where I think I am storing dates incorrectly. I save them as something like 1986-03-26

I read up a bit and it seems this type is meant to have a timestamp... no?

Anyways, I can echo the date out as "1989-03-26" perfectly fine, but I want to say :

echo date("d F Y",$date);

This gives me 31 December 1986... not cool. Anyone know of a solution?

View Replies !
Date Formats, Current/Historical Mode, LAMP Env
I'm working in a Lamp environment, (actually WAMP), am using one of the
many Calendar widgets (that has configurable formats), and have a heavy
data in/data out (forms/reports) webapp.

This is probably more of a design issue, than PHP issue, but we all
deal with this.
My 1st priority has been for simplicity, so I have used std. MySQL
format for the text input that feeds into the table.Column.

There are problems with that and I'd like to find out what better
choices may be available.
Obviously, choosing another format for forms-reports would require
manipulation of date to/from DB. What is the best way this be
implemented with consistency ?

I have considered saving space on the screen by working with implied
years but this seems destined to prove a headache no matter what. YY
format would be ambiguous in a decade. Mode System: Current or
Historical ? Use OO or switch() to present Xhtml reports
differently. Can it be made to change modes automatically ?

View Replies !
Converting Database Date To Normal Date
I am looking for a way to convert a date that is stored in a MySQL database like this after useing the date() function in PHP:

2006-08-16 21:03:54

and convert it into a date this:

16 August 2006 @ 11:03:54pm

Does anyone have some insight as to how I would go about doing that?

View Replies !
A Php- Mysql Problem- Date Formats Problem
I have a simple problem, I tried it but getting error, still trying to solve but thought will get the help from some experts too.

Database(mysql) date format :yyyy-mm-dd 00:00:00
client site query date is : dd/mm/yyyy

I have seprated the client side date into different portions like (dd) and (mm) and (yyyy). I can get them

My problems
------------------
(1) I want to query between two dates say 21/04/2004 to 23/04/2004 , how to do that?

(2) I want yyyy-mm-dd 00:00:00 , to seprate month , date , year , time from this format using php, how can I do that, I know its easy but I am not an expert on php and mysql.


I am using the following query...

View Replies !
Date Converting
I am retrieving a date from mysql (using the mysql date format YYYY-MM-DD format). Is there an easy way to convert a date in that format:
YYYY-MM-DD
to this format:
MM-DD-YYYY

View Replies !
Converting To Date
I collect some data from a user registration form in the format:

Day: 1-31 Month: 1-12 Year- 1990-2007

how i can convert this into proper date format so i can store it in my database :P?

View Replies !
Converting A Date To A Weekday
Would like to create a function that takes a date (for example: 20031009) as input and returns its weekday (thursday) as output.

View Replies !
Converting A Calender Date
I am converting a calender date..i got a example from PHP Manual. the code is PHP Code:

View Replies !
Converting Date To Minutes
I have $x="200504161035"
that is 10:35 on 16 April 2005.

My questuion: what is the *shortest* piece of code to convert that variable
to minutes? I have a feeling there is a PHP function that should be able to
do it but I cannot find it. The long way takes 5 lines of code.

View Replies !
Converting MySQL Date With PHP
is there a PHP function that will convert a MySQL formatted date like "2004-09-05" to "July 9, 2004"?

View Replies !
Converting A Variable To Date
I searched around for a bit and tried reading the documentation on the date function, but I think I'm missing something, and figured someone could probably answer this pretty quickly.

I'm coding a schedule creator for my school's television station. It's pretty basic (lots of forms and messy sql insertions). Code:

View Replies !
Date Converting To Mysql
I have to convert date to mysql supported form with?

View Replies !
Converting MySQL Date To PHP Day Of The Year
i was wondering if anyone knew if there was a way to convert a MySQL Date (yyyy-mm-dd) to a PHP day of the year

date(z);

as in like January the first would be day 1 (or 0 )

View Replies !
Converting A Date To Unix Timestamp
I have a form where people enter their birthday_day, birthday_month, and birthday_year

Is there a way to do the following;

convert_this_to_unix_timestamp($_POST['birthday_day'], $_POST['birthday_month'], $_POST['birthday_year']);

The point is that if i store it as a unix_timestamp, then i can do some math on it and return the users age instead of their birthday.

View Replies !
Problem With Converting A Date In MySQL
I am having a problem with converting a date in MySQL. MySQL stores it as 2004-06-30 and I want to display it as 30 Jun 2004. How can I convert the MySQL string into the output I like?

To further complicate this, I also would like to add 6 months to the outputted date! Is this easy or impossible?

View Replies !
Converting Dates To Mysql Date Field
Is there a way to convert a date in this format:

8-7-2002 to fit into a MySQL date field format 2002-08-07.

the 8-7-2002 is a field in which users pick a date from a pop-up calendar in javascript. When I enter that date into the database, i want to convert it to the MySQL date format.....is there a way to convert it?

View Replies !
Importing .csv Converting Date Back To 0000-00-00
I have imported a .csv file back in to MySql all the data has imported correctly. I never realised what a time saver working with .csv can be, as I always used to do find & replaces through notepad.

The only problem I am having is that the dates have defaulted to 0000-00-00

View Replies !
Converting Time Stamp To 'normal' Date Function
I'm looking for a bit of code/formulae to convert unix time stamp info into a conventional date format. I have a file that generates invoices from data requested from an sql table - trouble is it brings in the date as a timestamp. I'm looking for something I can plug into the php invoice file rather than altering the database.

View Replies !
Regex Issue - Converting A Written Date To A Timestamp
I have a problem, somehow through one of my scripts, all the timestamps in my database were set to 0000-00-00 00:00:00. I can fix this because one of the fields contains the written date in this format "Wednesday, June 7, 2006", I think I need to make a regex expression that can read that and generate a new timestamp from it,

I'm just not sure where to start because I've barely used regex. Some of the dates are not in that format because it contains over two years worth of data, and I want to just delete the ones that are not in that format as well. I'd appreciate any help here, I'm kind of stumped. Once I match the expression I can generate the timestamp, but I don't know how to match it.

View Replies !
Converting A Date Format (dd/mm/yyyy) Into A Time() Format
I want to convert a date in the format (dd/mm/yyyy) into a time() style format so I can compare it against the current time and only use information where its date is ahead of the current time.

View Replies !
PHP Mail Formats
I have a form that will use PHP to submit itself, do I get it to come in the form of a pdf or excel file to the recipents email.

View Replies !
Different Formats In A Textarea
when a user wants to reply to a spesific post (quote button), I want to load a php page with a textarea which will contain the original(to be answered) post in a diferrent style(italics small fonts) and let the user add his message below it in another style(bold bigger fonts).

Then by submiting it this will be stored in mysql without loosing the format.

View Replies !
Timestamp Formats
im trying to format a timestamp, for instance if date is today then it will return today then [time] and if date is yesterdays date then it will return it...I want it to work in different time zones, but im having a bit of trouble gettin it all together and working...can somone have a look and gove me some pointers? Code:

View Replies !
File Formats
how to specify the format for the domxml->dump_file method. I am at a loss; my document is being dumped as one great big long line, and I want to insert line breaks and spaces so that it is human readable.

View Replies !
Time Formats
i need to enter times into a DB in the format of 32.456 seconds what is the best tbl format to use?

View Replies !
Problems With Print Formats
I am a student an I'm rather novice in php. I try to format my text file depending on simbols I put in the text.

$array_e=explode("`",$array[$counter]); //Looking for E-mail signs in array, that was exploded from file
$max_e=count($array_e);
if ($max_e>1)
{for ($i=0; $i<($max_e); $i++)
switch ($array_e[$i])
{case 1:
print $array_e[$i]; print "<a href='mailto:";
break;
case 2:
print $array_e[$i]."><font color='#333B97'></font></a>";
break;
default:
print $array_e[$i]."
";
}

After this I receive simple text file without any "<a href='mailto..." Can somebody help me to understand where the problem.

View Replies !
Reading Other Formats I.e Winword
Does anyone know of any "translation" php code or sources of information that will allow me to write such to be able to read file formats such as Winword ?

The reason is I have a massive legacy system mostly in Word for Windows that I need to automate.

View Replies !
Striping Out Entities In All Three Formats
am trying to strip out all entities from some html and came accross this which strips them out if they are in name format (something like '&') or decimal format (something like '&') however it misses out on hexidecimal, i understand how it works except for chr('1'), not sure what the '1' means? or how to implement aversion for hexidecimal
any ideas?

$trans = get_html_translation_table(HTML_ENTITIES);
$trans = array_flip($trans);
$result = strtr($result, $trans);
$result = preg_replace('/&#([0-9]+);/me', "chr('1')", $result);

View Replies !
Get Iconv() List Of Formats
I know I can just get it from iconv -l at the prompt but within PHP without having to grep, sed or whatever. Any idea?

View Replies !
PHP SOAP Client Formats
ok, I am a little bit new to the SOAP game, but I understand it, and am
using it to talk to an outside API.

The problem that I have is that the server that I am talking to (that is
not in my control), will accept the following SOAP call

............

View Replies !
Numerical String Formats!
So I have a long number. Does anyone know how to easily round it down to 2 decimal places? 4.56794821 for example:

View Replies !
How To Resolve Video Formats
Can somebody suggest which PHP plugin would be best to use for uloaded files video format resolving?

Generally, I would need to resolve after somebody upload file few things:

1) if file is video or picture

2) if video or picture format, which one (mpeg, avi, wmv, gif, jpeg, ... )

3) video or picture resolution

I tried "Get ID3" plugin. It's not bad, but seems it have sometimes problems with memory leaks when wmv format is in case.

View Replies !
Strip String Formats
user's to format text before uploading to the database. It is then stored in the database as for example..

<strong>Header:</strong>

This is text inside. Is their any php function or way to strip the format values when I want to display them in a result set on the page. So in theory, I want to have it displayed as normal.

View Replies !
Stripping MIRC Text Formats
is there a way that i could strip off mIRC text tags like :

astring 11,12with colors and bolds 8,12

making it just : a string with colors and bolds

View Replies !
Upload Video Files Of Different Formats
I would like to upload video of different extensions like mpeg, mp4, mpg, wmv, avi to the server.
Currently only .avi extension is allowed.

THe main file which verifies the extension is below well part of the code..........

View Replies !
How To Stop Invalid File Formats From Being Uploaded?
I am trying to restrict users to only upload documents with .doc extenstions. I am running into a problem that if a user tries to upload a .xls file it is uploaded to the upload_tmp_dir first and then my error trapping comes into play. How do I prevent this .xls or any other file format other than .doc from uploading to the upload_temp_dir.? I am using 4.2.1 and NT 5.0.

View Replies !
Regex That Pulls All Formats Of Numbers From String
i'm trying to get something working that will pull whole numbers, proper and improper fractions, mixed numbers, and decimals from a string. here is as far as I've been able to get with my feeble regex skills: Code:

View Replies !
How To Pack() Several Formats And Write The Binary String Into A Db?
I tried to pack eight integer values and one string into one binary string, which I would like to store in a mysql db. I encountered two problems doing this: Code:

View Replies !
Get The Todays Date- Yesterdays Date And Tomorrows Date
I get the todays date- yesterdays date and tomorrows date, like so:

$yesterday = date ("Y-m-d", mktime (0,0,0,date("m"),(date("d")-1),date("Y")));

$tomorrow = date ("Y-m-d", mktime (0,0,0,date("m"),(date("d")+1),date("Y")));

$actualdate = date("Y-m-d");

Which returns the date in the format "200-11-13" But I need to add 13 hours to all three - how owuld I do this?

View Replies !
Converting 1 Into 01
Ok this is probably pretty easy, but since my english knowledge seems to insufficient to find this problem on php.net, I have to ask here!

I have a date (let's say a day) and I get this as eg. 1 2 ... 7 or 9

I just want this number to always have two digits!

01 02 ... 07 or 09

see my problem?

View Replies !
Converting ASP To PHP
I just tried out asp2php - a program that converts asp to php more or less successfully. There were a few parse errors I managed to get rid of in the converted script. But I have a line that is giving me my last parse error and I have no idea what is causing the problem. Can anybody help?

View Replies !
Converting From Tcl To Php
I am trying to convert the following tcl code to php.

each line of the file I'm reading is formatted like this:
United States|1|3

I know how to open a file and read it line by line but I don't know
how to split each line and assign the 3 items to variables in php.

while {[gets $ip eachline] > -1} {
set country_data [split $eachline "|"]
lassign $country_data country_name air_letter_zone air_post_zone
}

View Replies !
Converting Db Value
I have a textarea and would like to allow users to enter an html coded link, store it in the DB, all of this works fine. However I would then like to pull out of the DB the section and if it contains a html coded link turn it into an actual link and added target="_blank" to it. How can this been done. The data coming out make contain other information that will also need to be displayed.

View Replies !
Converting An Ai To Jpg?
Is it possible to convert an .ai file to another format (jpg, gif, or png) with either the GD Library? With ImageMagick using MagickWand?

View Replies !
Converting % To Dec.
I'm writing a CSI program for a body shop and need to be able to take % from the data they receive. This works well:

EI:

$yes = "30";
$total = "170";

$newtotal = ($yes * 100) / $total;

echo"$newtotal%";

Answer is: 17.647058823529411764705882352941%

How can I get the answer to just get:
17.6%?

Any ideas to limit this string?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved