Jump to content

How to find the month or week based on a timestamp


PC Nerd

Recommended Posts

Hi,

 

As the subject says, I'm attempting to find the timestamp of the beginning and the end of a month baed on another timestamp.

 

eg:

If i have the timestamp given by time();, then how would i find the timestamps for the beginning and end of tht month, or that week?

 

Thanks

ok - thanks.

 

Im faced with the issue that i cant see a getgmdate(); function anywhere.

 

Also, what woudl you say is the most efficient way to build my systen on GMT time, and then convert the displayed times into local time for the user.  I can store whatever value is needed int eh database - im yet to build the form that stores receives the data.  Would you recomend storing a GMT+-? value, or store a timezone abbreviation to use with strtotime()? etc?

 

Im also using this to create charts based on database data and the current time ( phpclasses gantt chart class if people here have used it).... so it will also be adjusted to local time for the user.

 

Any suggestion?

 

Thanks

ok - thanks...

 

how should i then convert that together?

Ill use gmdate(); and gmmktime(); etc, however im confused as to how i would convert to local time.

 

see if i store "+1400" or "-0730", is there a function i can use that will accept that and the other time? or do i have to use string clicing etc to get teh data out end eveluate it:

eg:

first character is "+" then:

        echo $gmTime + substr(1, 5)*60*60;

etc?

 

thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.