Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: [1] 2 3 4

Author Topic: Timezone problem  (Read 16822 times)

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« on: September 13, 2006, 08:00:28 pm »

I just installed "sNews 1.5.26 RC version".   So far, all good. Thanks to the team for the time and effort invested!

I only have one problem, which I also had with the older version.  How do I change the time zone?  Under the old version there was an option, which never worked for me.  What am I suppose to do in version 1.5 to change the time zone?
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #1 on: September 14, 2006, 01:35:46 am »

Now I will make, what is probably another dumb question:
The date that appears in each article and the comments … Where does that data come from?  Can I make it appear in another language (Spanish)?

Ex: “Septiembre 13 del 2006”  Main reason is because the time format changes among countries, USA mm/dd/yyyy and some latin America countries dd/mm/yyyy.  Can get kind of confusing.
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Timezone problem
« Reply #2 on: September 14, 2006, 07:50:03 am »

Quote from: Z
1. What am I suppose to do in version 1.5 to change the time zone?
2. Where does that data come from?  Can I make it appear in another language (Spanish)?
Hey, Z...

First question - was in an earlier release solved by a setting in...settings ;). But I can't find that now...Luka, Mika ?? The only thing I find is a "Time on server" thiny in the snews.php, but that isn't good as my server could be placed in US and I live in Sweden...
What you can do is add a "datethingy attribute" to make the line add eg "blahblahbla 21:01:19 +02:00" (Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3))

Second question - Yupp, you can. But it's tricky... (atleast I thought so, so I didn't bother ;) I just changed the date line to contain formattings to show only time and date without the "words" see PHP date and time syntax here: http://se2.php.net/date). If you still wanna try, Google is a wonderful thing ;)... http://www.google.se/search?hl=sv&q=php+date+in+other+languages&btnG=S%C3%B6k&meta=

I haven't got a clue how to solve this, but I know it can be done somehow, as I did ask the exact same question some time ago...but as stated - I put it to rest;)

Patric.
Logged
"It's only dead fish that goes with the flow... "
Updated

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #3 on: September 18, 2006, 07:40:52 pm »

Quote
...What you can do is add a "datethingy attribute" to make the line add eg "blahblahbla 21:01:19 +02:00"
Hmm, How do I do that?... make it dummy friendly!
And please don't assume I should know the "thingy", because I don't.

I got this little code googleing around - (I changed some of it to English)
Code: [Select]
Never mind.  Code was of no much useIt seems to work fine; I just don't know how to integrate it with sNews.  I played around with it for a couple of minutes with no success.  Any help will be greatly appreciated!!
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Timezone problem
« Reply #4 on: September 18, 2006, 07:57:02 pm »

Have you tried adding it to your template (where you want it to display) using a function inclusion statement, as we do with the other functions we call into the template?

1. You would need to combine all your code into one function in the file.
2. For this example, let's call the file datestring.php and, the function in it - datestring().
3. Find include ("snews.php"); and right after it, insert include ("datestring.php"); .
4. Then - where you want the date string displayed - insert
Code: [Select]
to call the function from the datestring.php file.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Timezone problem
« Reply #5 on: September 18, 2006, 09:51:01 pm »

The only thing I've found that has to do with date settings is, when logged in to the Admin area in the browser, to click on Settings, then Time and Locale settings. You can't define timezone there, but Date Format. So you can arrange the the way the date is printed to your liking, but not (I think) the way you want it, e.g
Quote from: Z
Septiembre 13 del 2006
Your solution in combination with key's recommendation seems the way to go for that.
Logged

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #6 on: September 19, 2006, 04:01:04 am »

Quote from: keyrocks
Have you tried adding it to your template
Yes I have, but I can not get it, where I want it, which is just on the highlighted line (yellow) next to Comments.  Please visit the following link to see what I mean:
http://www.zucye.net

Quote from: agentsmith
...click on Settings, then Time and Locale settings. You can't define timezone there, but Date Format. So you can arrange the the way the date is printed to your liking, but not (I think) the way you want it, e.g
That part was not so hard, if you visit the link above, you will see that I almost got it to my liking :) and the way I want it :) BUT, The language and the Time Zone setting are giving me a hard time.
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Hoang, Nguyen Duc

  • Newbie
  • *
  • Karma: 0
  • Posts: 35
    • http://kent.vnideadesign.com
Timezone problem
« Reply #7 on: September 19, 2006, 04:39:59 am »

Try adding this at the first line of your main php file

Code: [Select]
date_default_timezone_set("US/Eastern");I don't know what is your timezone so i choose US/Eastern as an example. Hope this fix your problem

Btw, check timezone identifiers here : http://www.php.net/manual/en/timezones.php
Logged
A signature is a small piece of text that is attached to your posts.

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #8 on: September 19, 2006, 04:52:47 am »

:( I didn't work!!

Quote from: KENT
Try adding this at the first line of your main php file

Code: [Select]
date_default_timezone_set("US/Eastern");
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Hoang, Nguyen Duc

  • Newbie
  • *
  • Karma: 0
  • Posts: 35
    • http://kent.vnideadesign.com
Timezone problem
« Reply #9 on: September 19, 2006, 12:09:15 pm »

What timezone are you in ? I guess you live in New Jersey, USA but dont know what timezone covers your location, tell me
Logged
A signature is a small piece of text that is attached to your posts.

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #10 on: September 19, 2006, 03:15:19 pm »

Quote from: KENT
What timezone are you in ? I guess you live in New Jersey, USA but dont know what timezone covers your location, tell me
US/Eastern   -5
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Timezone problem
« Reply #11 on: September 19, 2006, 03:35:53 pm »

Quote from: Zucye
Quote from: KENT
What timezone are you in ? I guess you live in New Jersey, USA but dont know what timezone covers your location, tell me
US/Eastern   -5
I am in the same time zone. I think we refer to this as Eastern Daylight Time (EDT) over here in North America.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #12 on: September 19, 2006, 06:32:05 pm »

I solved Question #1 :D :D :D :D :D.  Display the Time, according to my time zone:

Add the following to your .htaccess file, accoding to your time zone:
Code: [Select]
SetEnv TZ "US/Eastern"It only applied to new entries, previous post retain the old time format.
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #13 on: September 20, 2006, 12:37:28 am »

I found solution for problem #2

Can see how it looks here:
http://www.zucye.net
***Just a testing site***


Thanks to keyrocks, KENT, agentsmith and Patric for the suggestions, but I am kind of disappointed on some of you guys.  It took me hours to figure this out…. Never the less, the solution was so easy, I can’t believe you couldn’t help me out. :( :( :(

Anyway here it goes.
1st add the following line to snews.php:
Code: [Select]
setlocale (LC_ALL, 'es_ES','esp','es_ES@euro');

Change the above es_ES for your language, you only need
one,  I used 3 just in case.
I placed it right after:
error_reporting(E_ALL ^ E_NOTICE);
2nd.  Change all the instances of date(..... on snews.php
Code: [Select]
Change all the instances of "date(" to "strftime ("  

with the exception of those containing the following
format - date("Y-m-d H:i:s") - there are 3 of them that don't
need to be changed.
3rd  Use the following format on Setting ...Time and Locale settings
Code: [Select]
%A %d de %B de %Y - %R

or whatever you want using the %variables
I still have one problem the fist letter on the day and Month don't appear capitalized.  (This Is just note, not that I am expenting much help)
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Timezone problem
« Reply #14 on: September 20, 2006, 01:02:03 am »

Not saying enough is part of the learning experience... ;D
Seriously, for my part I don't know much about PHP so I just state things I know or think I know, especially if I don't have time to dig around for answers. CSS is another matter. CSS I know.

Solution to your First letter of the Day problem? Try using "l" (lowercase L) instead of "d" in your date string.
Don't suppose it's much help though, since I don't know a lot of PHP.
Example:
Quote
format - date("Y-m-l H:i:s")
Logged
Pages: [1] 2 3 4