Jump to content


Photo

re-order date()


  • Please log in to reply
9 replies to this topic

#1 almightyegg

almightyegg
  • Members
  • PipPipPip
  • Advanced Member
  • 791 posts
  • LocationEngland

Posted 26 October 2006 - 03:33 PM

i have $time = date(Y-d-m H:i:s); and it works fine, but i want it to be day-month-year and in GMT time  ???
Visit my Game - Under Construction

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 26 October 2006 - 03:36 PM

You can try using the gmdate() function.

Ken

#3 almightyegg

almightyegg
  • Members
  • PipPipPip
  • Advanced Member
  • 791 posts
  • LocationEngland

Posted 26 October 2006 - 03:41 PM

thanks that now shows in right order but currently uk is in GMT + 1 hour...how would i put that into:
$time = gmdate("d-m-Y H:i:s");

Visit my Game - Under Construction

#4 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 26 October 2006 - 03:48 PM

<?php

$time = date("d-m-Y H:i:s",strtotime('now + 1 hours'));

?>


#5 almightyegg

almightyegg
  • Members
  • PipPipPip
  • Advanced Member
  • 791 posts
  • LocationEngland

Posted 26 October 2006 - 03:54 PM

Yay!! thank you both :)
Visit my Game - Under Construction

#6 almightyegg

almightyegg
  • Members
  • PipPipPip
  • Advanced Member
  • 791 posts
  • LocationEngland

Posted 26 October 2006 - 04:12 PM

oooh wait...i went to update my database with 00-00-0000 00:00:00 rather than 0000-00-00 00:00:00 and it wouldnt let me change it...so the new time doesnt go in, leaving it at 0000-00-00 00:00:00 in the database...how do i change it??
Visit my Game - Under Construction

#7 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 26 October 2006 - 07:09 PM

Your mysql field type is probably set as "DATETIME" then, you can e.g. change it to VARCHAR or something,
more info found here:
http://help.scibit.c...ield_Types.html


#8 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 26 October 2006 - 07:13 PM

Leave how it's stored in the DB alone. Just display it differently.

Ken

#9 almightyegg

almightyegg
  • Members
  • PipPipPip
  • Advanced Member
  • 791 posts
  • LocationEngland

Posted 26 October 2006 - 07:28 PM

alpines way worked fine :)
Visit my Game - Under Construction

#10 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 26 October 2006 - 07:33 PM

If you have a lot of existing different scripts (pages) that you display the date in, my way is the easiest one - but, i still agree with kenrbnsn that you for future purposes might want to store all dates in datetime format and modify it when you want to use it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users