![]() |
|
#1
|
||||
|
||||
How do I get 'last month' in YYYYmm format?Updated Information: Function to ADD (to) DATE with PHP.
I always assumed this was something simple UNTIL I attempted to actually write it... If I get the time now (mktime() for instance), how do I get last month in this format: 200212 (i.e. December 2002)? __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ Last edited by JdS : 25-Aug-2004 at 01:08.
Reason: Inserted link to recent / updated information.
|
|
#2
|
|||
|
|||
|
getdate() can take a Unix timestamp as input, and is more accurate IMHO
PHP Code:
I've got no way to check this, so please debug carefully. Sorry. GF |
|
#3
|
||||
|
||||
|
How would this work for Jan 2003?
Even if it worked, it would just probably show Dec 2003... or did I miss something in the code? __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#4
|
||||
|
||||
YES! It does work...Thanks Garth, it DOES work... I just missed that one line when I looked at your code earlier. Anyway, I made some small changes to your code and so far so good (with the testing)..
PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
|||
|
|||
|
Great, C++ hasn't me completely screwed up then
GF |
Recent GIDBlog
Toyota - 2008 July Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 150 mb storage only $3.30 a month! | WebServeHosting | Web Hosting Advertisements & Offers | 0 | 25-Nov-2003 01:28 |
| Free 1st month / Free setup / No credit card needed...Plans start at 4.95 | LarryIsaac | Web Hosting Advertisements & Offers | 0 | 11-Oct-2003 14:03 |
| 500MBs of Space, 20 GBs of Traffic $7.95 a month. No contracts. | solokron | Web Hosting Advertisements & Offers | 0 | 04-Oct-2003 02:04 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The