Current location: Hot Scripts Forums » Programming Languages » PHP » date problem - convert eg. '06' to 'jun'


date problem - convert eg. '06' to 'jun'

Reply
  #1 (permalink)  
Old 04-16-05, 09:39 AM
tallpaul858 tallpaul858 is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Question date problem - convert eg. '06' to 'jun'


ive got a date stored in my mysql database as 00/00/0000 (dd/mm/yyyy)

i dont want to store it as 00/jan/0000 for many reasons.

is there an easy way of taking the month as 01 and converting it into JAN or 03 to MAR without writing a whole load of if / case statements?

ie. is there a way of doing it with date() or timestamp() ? i only want to display it as MAR,JUN etc... not convert it in the db.

thanks,

paul
Reply With Quote
  #2 (permalink)  
Old 04-16-05, 11:41 AM
moronovich moronovich is offline
Junior Code Guru
 
Join Date: Oct 2004
Posts: 460
Thanks: 0
Thanked 0 Times in 0 Posts
rtfm first:
Quote:
php functions: date, mktime, strtotime
pointer:
common date format: (long) timestamp -> saved in db
displayed format: (string) date -> converted from the timestamp saved in db
__________________
just an ignorant noob with moronic solution...
Reply With Quote
  #3 (permalink)  
Old 04-16-05, 02:37 PM
JBChris JBChris is offline
Newbie Coder
 
Join Date: Sep 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Make a timestamp with your sql date, then insert it where you would put a timestamp in date().
PHP Code:

<?php

print date('M'[, timestamp]);
?>
Reply With Quote
  #4 (permalink)  
Old 04-16-05, 06:39 PM
tallpaul858 tallpaul858 is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
thanks guys, thats helped loads,

got it working now,

regards, paul
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie found a solution to a date problem. mickey_kamer Perl 4 05-09-07 05:54 AM
Please Solve SQL Date Range Problem ishaqani ASP 0 12-11-04 03:59 PM
convert a date into an int Deadlock PHP 1 12-07-04 04:41 AM
date problem jaishalg PHP 1 06-15-04 08:28 AM
Problem with date and form djavet PHP 3 05-02-04 12:37 AM


All times are GMT -5. The time now is 06:39 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.