[wdvltalk] [PHP] reformat date...

2007-01-25 Thread Tris

Simply put, I'm REALLY hungover, and want to die...
However, before I go home.. I have to convert:

(string)3/MAY/07   -- (date for MySQL)2007-05-03

google is confusing me...
NEVER drinking again.

Tris...

--
When a person can no longer laugh at himself, it is time for others to
laugh at him.
Thomas Szasz

 � The WDVL Discussion List from WDVL.COM � 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: archive@jab.org
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] [PHP] reformat date...

2007-01-25 Thread r937

(string)3/MAY/07   -- (date for MySQL)2007-05-03


   select  str_to_date('3/MAY/07','%e/%M/%y')
   from daTable...

;o)

 � The WDVL Discussion List from WDVL.COM � 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: archive@jab.org
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] [PHP] reformat date...

2007-01-25 Thread Tris

sorry, it's for inclusion into a db.. so I need to convert the date
before I create my MYSQL satement...

On 25/01/07, r937 [EMAIL PROTECTED] wrote:

 (string)3/MAY/07   -- (date for MySQL)2007-05-03

select  str_to_date('3/MAY/07','%e/%M/%y')
from daTable...

;o)

 � The WDVL Discussion List from WDVL.COM � 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.




--
When a person can no longer laugh at himself, it is time for others to
laugh at him.
Thomas Szasz

 � The WDVL Discussion List from WDVL.COM � 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to $subst('List.Name') as: 
$subst('Recip.EmailAddr')
To unsubscribe send a blank email to $subst('Email.UnSub')
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Re: [wdvltalk] [PHP] reformat date...

2007-01-25 Thread r937

sorry, it's for inclusion into a db.. so I need to convert the date
before I create my MYSQL satement...


no you don't ;o)

insert into mytable ( ... mydatecol, ... )
values ( ... , str_to_date('3/MAY/07','%e/%M/%y'), ... )

also, please be kind enough to trim your replies

thanks

rudy
http://r937.com/

 � The WDVL Discussion List from WDVL.COM � 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: archive@jab.org
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] [PHP] reformat date...

2007-01-25 Thread Matthew Macdonald-Wallace

Quoting r937 [EMAIL PROTECTED]:


sorry, it's for inclusion into a db.. so I need to convert the date
before I create my MYSQL satement...


no you don't ;o)

insert into mytable ( ... mydatecol, ... )
values ( ... , str_to_date('3/MAY/07','%e/%M/%y'), ... )

also, please be kind enough to trim your replies


awww, be kind to the guy, he's hung over...

/me throws a load of PHP at Tris - check this out:


// input the date as a string
$textDate = 3/MAY/07;
// replace the / with  
$initDate = str_replace(/, ,$textDate);
// convert the new date string (dd mm YYY) to a unix timestamp
$date = strtotime($initDate);
// convert the timestamp into the correct format
$correctformat = date(Y-m-d,$date);
// print the format out
echo $correctformat;
// add credit to Matt for giving you the code... ;)
---

it works for me

Cheers,

Matt
--
Matthew Macdonald-Wallace
[EMAIL PROTECTED]
Sed quis custodiet ipsos custodies?




 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] [PHP] reformat date...

2007-01-25 Thread r937

also, please be kind enough to trim your replies


awww, be kind to the guy, he's hung over...


i thought my request was actually very polite

and i'm afraid there ~is~ no excuse for ignoring list etiquette

as for your php, did you see my STR_TO_DATE solution?

why would you want to take time to write code for something that a mysql 
function handles easily?


:o) 



 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: archive@jab.org
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] [PHP] reformat date...

2007-01-25 Thread Matthew Macdonald-Wallace

Quoting r937 [EMAIL PROTECTED]:


also, please be kind enough to trim your replies


awww, be kind to the guy, he's hung over...


i thought my request was actually very polite


yup, it was, one of these days we'll invent voice-based email and the  
tones of our voices will be heard, leaving no room for the  
misinterpretation of written comments (something I've fallen foul of  
on many occasions!) - hang on, isn't called a phone?! :)



and i'm afraid there ~is~ no excuse for ignoring list etiquette


fair enough.


as for your php, did you see my STR_TO_DATE solution?
why would you want to take time to write code for something that a
mysql function handles easily?


I saw it, it makes a huge amount of sense to do it in one line, but I  
wanted to see if I could do it with raw PHP! I can, I have and I  
wouldn't recommend it, but it is a solution in PHP that doesn't use  
the MYSQL function which I think is what Tris was after.  Then again,  
if he's hungover enough to not want to drink, he may not know what  
he's after at all and he may well have to spend tomorrow unpicking the  
code he wrote today (I've had to in the past!).


Cheers,

Matt

--
Matthew Macdonald-Wallace
[EMAIL PROTECTED]
Sed quis custodiet ipsos custodies?




 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.