Jump to content


changing a date/time snippet to read w/words


  • You cannot reply to this topic
4 replies to this topic

#1 Deb

    Likes Etomite Forums!

  • Member
  • PipPip
  • 253 posts

Posted 16 January 2005 - 11:57 AM

Hi,

I'm using snippet for the date/time. It is all numerical and I was wondering if there is a way to change from numerical:

01-16-2005 04:55:10

to something more like: January 16, 2005 04:55:10 CST (spell it out in other words is what I mean). I don't know a lick of php except how to copy/paste it!

Thanks a bunch! After my initial 12 hours of hair pulling to modify a template and find my way around I'm finding that I think I like this Etomite thingamabob =)

Deb

#2 yomemiconmigo

    Etomite Forum Fan

  • Member
  • Pip
  • 68 posts

Posted 16 January 2005 - 01:38 PM

I'm afraid I can't help you on this one. All I can say is that if you want to follow web standards for date and time (to make your date understandable to all users regardless of where they come from), the date and time should be expressed as YYYY-MM-DDThh:mm (meaning Year -4 digits-, month -2 digits-, day -2 digits-, hour -2 digits-, and minute -2 digits-)
I have modified the snippet to display that (simply altered the order, don't overestimate my capacities :)

if(!isset($timestamp)) {
$timestamp=time();
}

return strftime("%Y-%m-%d %H:%M:%S", $timestamp);

But then, this is not what you wanted, I guess :(

#3 Deb

    Likes Etomite Forums!

  • Member
  • PipPip
  • 253 posts

Posted 16 January 2005 - 01:59 PM

Thank you for trying. I did figure out that changing the order at least got me the m/d/y scenerio. I would still rather have it written out. Just a little quirk of mine I guess.

I'm not concerned about this particular site being "standardized" as it's just a personal site for my niece for her photography and will only be visited by friends/family and they don't know the difference if it's standardized or not <g>

Deb

#4 breezer

    Likes Etomite Forums!

  • Member
  • PipPip
  • 308 posts

Posted 17 January 2005 - 02:30 PM

:) Here are some snips I found which may have some use to you....

/* Assume today is March 10th, 2001, 5:16:18 pm */

$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm

$today = date("m.d.y"); // 03.10.01

$today = date("j, n, Y"); // 10, 3, 2001

$today = date("Ymd"); // 20010310

$today = date('h-i-s, j-m-y, it is w Day z '); // 05-16-17, 10-03-01, 1631 1618 6 Fripm01

$today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // It is the 10th day.

$today = date("D M j G:i:s T Y"); // Sat Mar 10 15:16:08 MST 2001

$today = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:17 m is month

$today = date("H:i:s"); // 17:16:17


or this script below can be placed anywhere and it produces

Jan 17, 2005

<script type="text/javascript">
<!--   // Array ofmonth Names
var monthNames = new Array( "January","February","March","April","May","June","July","August","September","October","November","December");
var now = new Date();
thisYear = now.getYear();
if(thisYear < 1900) {thisYear += 1900}; // corrections if Y2K display problem
document.write(monthNames[now.getMonth()] + " " + now.getDate() + ", " + thisYear);
// -->
</script>

:eto:

#5 Deb

    Likes Etomite Forums!

  • Member
  • PipPip
  • 253 posts

Posted 17 January 2005 - 06:11 PM

Awesome! Thanks so much!

Deb





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users