[PHP-DB] date format problem
my problem is with date format mysql support -mm-dd but my client not use to enter date in -mm-dd format he use to in dd-mm-yyy format how can it possible to input date in dd-mm- format
RE: [PHP-DB] date format problem
www.php.net/date will show you all the possibilities of formatting the date bastien Date: Sat, 22 Dec 2007 17:54:07 +0600 From: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] date format problem my problem is with date format mysql support -mm-dd but my client not use to enter date in -mm-dd format he use to in dd-mm-yyy format how can it possible to input date in dd-mm- format _ Use fowl language with Chicktionary. Click here to start playing! http://puzzles.sympatico.msn.ca/chicktionary/index.html?icid=htmlsig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date format problem
Hello, I have a field in my mysql db wich is a timestamp with the format mmddhhmmss and I would like to display it like: dd/mm/ how do I do that? Thank you in advance, Dani --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.502 / Virus Database: 300 - Release Date: 18/7/2003 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Date format problem
I have a field in my mysql db wich is a timestamp with the format mmddhhmmss and I would like to display it like: dd/mm/ http://www.mysql.com/doc/en/Date_and_time_functions.html#IDX1333 SELECT DATE_FORMAT(timestamp_col_name, '%d/%m/%Y') FROM table_name -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date format in MySQL
Hi All, I have a date format of -MM-DD in MySQL and am showing it on a PHP page. However I want to show it as 2 February, 2003 or 2 February Can someone please help me. The date will not necessarily be todays date (I looked at the datetime() function and the getdate() function but couldn't work it out for these) Thanks for your support All the best Lisa Lisa Rubanowicz CNH Ireland Tel: +353 46 77663 Email: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
Re: [PHP-DB] Date format in MySQL
strftime() offers a lot of formatting options for dates. Hope it helps. RUBANOWICZ Lisa wrote: Hi All, I have a date format of -MM-DD in MySQL and am showing it on a PHP page. However I want to show it as 2 February, 2003 or 2 February Can someone please help me. The date will not necessarily be todays date (I looked at the datetime() function and the getdate() function but couldn't work it out for these) Thanks for your support All the best Lisa Lisa Rubanowicz CNH Ireland Tel: +353 46 77663 Email: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] -- John Krewson Programmer - SWORPS -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date format in MySQL
Or if you want to change it when you're pulling out of mysql you can use the DATE_FORMAT( ) function... hth jeff John Krewson krewsonj@sworp To: RUBANOWICZ Lisa [EMAIL PROTECTED] s.utk.educc: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: Re: [PHP-DB] Date format in MySQL 02/03/2003 09:32 AM strftime() offers a lot of formatting options for dates. Hope it helps. RUBANOWICZ Lisa wrote: Hi All, I have a date format of -MM-DD in MySQL and am showing it on a PHP page. However I want to show it as 2 February, 2003 or 2 February Can someone please help me. The date will not necessarily be todays date (I looked at the datetime() function and the getdate() function but couldn't work it out for these) Thanks for your support All the best Lisa Lisa Rubanowicz CNH Ireland Tel: +353 46 77663 Email: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] -- John Krewson Programmer - SWORPS -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date format in MySQL
$query = mysql_query(SELECT UNIX_TIMESTAMP(fieldname) AS date WHERE id = '1';); $array = mysql_fetch_array($query); $mydate = date(j F, Y,$array[date]); Change fieldname and the where clause, and that should work. If you want to further munipulate how it looks, just look at the date manual page: http://www.php.net/date And change the first parameter to the date function. On Mon, 2003-02-03 at 09:09, RUBANOWICZ Lisa wrote: Hi All, I have a date format of -MM-DD in MySQL and am showing it on a PHP page. However I want to show it as 2 February, 2003 or 2 February Can someone please help me. The date will not necessarily be todays date (I looked at the datetime() function and the getdate() function but couldn't work it out for these) Thanks for your support All the best Lisa Lisa Rubanowicz CNH Ireland Tel: +353 46 77663 Email: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] date format to dateformat
What if $date=10-02-2002; I tried it this way and the explode causes problems with the - in it What would be the best way to deal with this should i just parse out the -? Andrey Sosnitsky [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello CrossWalkCentral, Sunday, September 22, 2002, 7:06:18 AM, you wrote: Try this $date= 10 01 2002; list ($day, $month, $year) = explode( , $date); echo $year-$month-$day; C I am having problems coverting the followign date format. Does any one have C any insight on this. C $date= 10 01 2002 C I need to conver this to Y-m-d C any help would be great www.pskov.ru www.invest.pskov.ru -- Best regards, Andreymailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP-DB] date format to dateformat
Hello, CrossWalkCentral. You wrote 23 ñåíòÿáðÿ 2002 ã., 2:05:38: So, explode() requires a seperator as a first argument. You code is $date= 10-01-2002; list ($day, $month, $year) = explode(-, $date); echo $year-$month-$day; See PHP manual at http://www.php.net/manual/en/function.explode.php C What if C $date=10-02-2002; C I tried it this way and the explode causes problems with the - in it C What would be the best way to deal with this should i just parse out the -? www.pskov.ruwebmaster|programmer|DBA www.invest.pskov.ru www.education.pskov.ru -- Best Regards, Andrey mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP-DB] date format to dateformat
That did it thanks Andrey Sosnitsky [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, CrossWalkCentral. You wrote 23 ñåíòÿáðÿ 2002 ã., 2:05:38: So, explode() requires a seperator as a first argument. You code is $date= 10-01-2002; list ($day, $month, $year) = explode(-, $date); echo $year-$month-$day; See PHP manual at http://www.php.net/manual/en/function.explode.php C What if C $date=10-02-2002; C I tried it this way and the explode causes problems with the - in it C What would be the best way to deal with this should i just parse out the -? www.pskov.ruwebmaster|programmer|DBA www.invest.pskov.ru www.education.pskov.ru -- Best Regards, Andrey mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] date format to dateformat
I am having problems coverting the followign date format. Does any one have any insight on this. $date= 10 01 2002 I need to conver this to Y-m-d any help would be great -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] date format display
Hello dear all, in my mysql-db I have a date_tbl with this format: (20020531). how is possible in PHP do display date_tbl's values in a more human-readable format like 05-31-2002 or 31/05/2002 ? thaks in advance, regards fabrizio -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date format display
Monday, June 10, 2002, 2:00:59 PM, you wrote: in my mysql-db I have a date_tbl with this format: (20020531). how is possible in PHP do display date_tbl's values in a more human-readable format like 05-31-2002 or 31/05/2002 ? Look at date and strtotime... http://www.php.net/date http://www.php.net/strtotime Also take a look at DATE_FORMAT in the MySQL manual... http://www.mysql.com/doc/D/a/Date_and_time_functions.html -- Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date format display
This function will fix your date display. $sqldate=20020531; $sqldate= fixdate($sqldate); function fixdate($data){ $aux=; $z=0; for($i=0; $istrlen($data); $i++) { if($i=3) { $aux[0].=$data[$i]; } if($i==4 or $i==5) { $aux[1].=$data[$i]; } if($i==6 or $i==7) { $aux[2].=$data[$i]; } } $mdate= $aux[1]./.$aux[2]./.$aux[0]; if(checkdate($aux[1], $aux[2], $aux[0])) { Return $mdate; } else { Return ERROR; } } fabrizio [EMAIL PROTECTED] wrote: Hello dear all, in my mysql-db I have a date_tbl with this format: (20020531). how is possible in PHP do display date_tbl's values in a more human-readable format like 05-31-2002 or 31/05/2002 ? thaks in advance, regards fabrizio -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ~ Manuel Ochoa ~ Seven days is too long to wait for a gun! - Do You Yahoo!? Sign-up for Video Highlights of 2002 FIFA World Cup
RE: [PHP-DB] date format display
This is how I'd do it: $strtime = 20020531; // Example date string // STEP 1: Turn the MMDD string into a UNIX date $unixtime = mktime(substr($strtime, 8, 2),substr($strtime, 10, 2),0,substr($strtime, 4, 2),substr($strtime, 6, 2),substr($strtime, 0, 4)); // STEP 2: Use the date() function to format the date however you'd like echo date(m-d-Y, $unixtime); // Outputs 05-31-2002 echo date(d/m/Y, $unixtime); // Outputs 31/05/2002 Things I highly recommend reading: http://www.php.net/manual/en/function.substr.php http://www.php.net/manual/en/function.mktime.php http://www.php.net/manual/en/function.date.php You'll really want to read the page about the date function. The options for formatting your date output are just about limitless. Gary Pullis Office Management Technologies http://www.omt.cc -Original Message- From: fabrizio [mailto:[EMAIL PROTECTED]] Sent: Monday, June 10, 2002 9:01 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] date format display Hello dear all, in my mysql-db I have a date_tbl with this format: (20020531). how is possible in PHP do display date_tbl's values in a more human-readable format like 05-31-2002 or 31/05/2002 ? thaks in advance, regards fabrizio -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date format question
Hi, You could try to change date(m) to date(n), and date(d) to date(j). It looks that sometimes mktime() doesn't remove the trailing zeroes and returns totally different dates. The other thing you could try is $date = date(F dS, Y g:i:s A, date(U)+18000); this one takes the number seconds of seconds between the Unix Epoch (January 1 1970) and the currend time and adds 5 hours (18000 seconds) Hope this helps Dobromir Velev -Original Message- From: Matt Nigh [EMAIL PROTECTED] To: php-db [EMAIL PROTECTED] Date: Wednesday, November 28, 2001 03:49 Subject: [PHP-DB] date format question hi, i'm wondering if anyone could help me in formatting a date so it is 5 hours ahead of the server time. here's the code i'm using but it doesn't seem to work: $date = date(F dS, Y g:i:s A, mktime(date(g)+5,date(i),date(s),date(m),date(d),date(Y)) ); i've already looked in the manual and around the net for stuff, but wasn't able to find anything for what i needed. if anyone could help out, i'd appreciate it. thanks, Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] date format question
hi, i'm wondering if anyone could help me in formatting a date so it is 5 hours ahead of the server time. here's the code i'm using but it doesn't seem to work: $date = date(F dS, Y g:i:s A, mktime(date(g)+5,date(i),date(s),date(m),date(d),date(Y)) ); i've already looked in the manual and around the net for stuff, but wasn't able to find anything for what i needed. if anyone could help out, i'd appreciate it. thanks, Matt
RE: [PHP-DB] date format question
try H as your hour format (date(H)+5) although out of interest, at 9:51am, using either g or H gives me 2:51 pm HTH /beau // -Original Message- // From: Matt Nigh [mailto:[EMAIL PROTECTED]] // Sent: Wednesday, 28 November 2001 9:48 AM // To: php-db // Subject: [PHP-DB] date format question // // // hi, // i'm wondering if anyone could help me in formatting a date // so it is 5 hours ahead of the server time. // here's the code i'm using but it doesn't seem to work: // // $date = date(F dS, Y g:i:s A, // mktime(date(g)+5,date(i),date(s),date(m),date(d),da // te(Y)) ); // // i've already looked in the manual and around the net for // stuff, but wasn't able to find anything for what i needed. // if anyone could help out, i'd appreciate it. // // thanks, // // // Matt // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Date Format
Hi CK, I always fetch the Date like SELECT UNIX_TIMESTAMP(Timestamp) AS Timestamp so you can manipulate it with all the PHP Date- and Timefunctions like date(). So you can display the date the way you asked with: $Timestamp = ; // fetch the Timestamp the way you like =8) echo date( d-m-Y, $Timestamp ); Thats it. Hope this helps. Greetinx, Mike Michael Rudel - Web-Development, Systemadministration - Besuchen Sie uns am 20. und 21. August 2001 auf der online-marketing-düsseldorf in Halle 1 Stand E 16 ___ Suchtreffer AG Bleicherstraße 20 D-78467 Konstanz Germany fon: +49-(0)7531-89207-17 fax: +49-(0)7531-89207-13 e-mail: mailto:[EMAIL PROTECTED] internet: http://www.suchtreffer.de ___ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of system Sent: Saturday, July 14, 2001 5:17 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Date Format Friends, I have a design, up and running scripts connected to MySQL. How do I retrieve date formats and have it displayed as dd-mm- ? I store them as DATE. CK Raju -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Date format in MSSQL
How I can format date in php query from MSSQL? Jack -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Date format in MSSQL
Hi Have a look in Books Online - the e-docs for MSSQL - search for the convert function and all will be revealed. Peter - Original Message - From: Jack [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 19, 2001 5:49 PM Subject: [PHP-DB] Date format in MSSQL How I can format date in php query from MSSQL? Jack -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Date Format
Friends, I have a design, up and running scripts connected to MySQL. How do I retrieve date formats and have it displayed as dd-mm- ? I store them as DATE. CK Raju -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Date Format
?php $date = 2001-07-19; // as if it just came from the db $date_array = explode('-',$date); $date = $date_array[1] . - . $date_array[2] . - . $date_array[0]; ? That should do it = Good luck! Ben -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of system Sent: Friday, July 13, 2001 8:17 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Date Format Friends, I have a design, up and running scripts connected to MySQL. How do I retrieve date formats and have it displayed as dd-mm- ? I store them as DATE. CK Raju -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Date Format.
Hello all, I'm on the last leg of a project I'm doing, and maybe I'm just too fried but I've tried several things. Can anyone help: I've created an Event Listing form. The script pulls the table names from the DB and preg's them to create the field names for the form. Any field name that contains Date will be parsed as a Date. What's the best, most flexible way to go about parsing the user input into a Unix Timestamp? I've been using strtotime() and it seems to be off when the user types in 7-6-00 formatted dates. Is it possible to do without requiring the user use a specific format when entering dates? I'm also not stuck on using the Unix TS, but since I need to do a SELECT * I can't abstract any fields with SELECT DATE_FORMAT(). Anyone have any suggestions? Really the only problem here is that I can't select individual fields so I can't use MySQL date formatting without two queries. Thanks, John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]