|
Joined: Jan 2003
Posts: 125
Journeyman
|
Journeyman
Joined: Jan 2003
Posts: 125 |
I'm attempting to manipulate a flat text file (csv) that stores day/time info in the following format:
YEAR, TIME(24), DAY OF YEAR eg: 2003, 1500, 310
Which functions would I use to format this into a timestamp: MM/DD/YYYY HH:MM:SS?
Thank you in advance for any help!
|
|
|
|
Joined: May 1999
Posts: 1,715
Addict
|
Addict
Joined: May 1999
Posts: 1,715 |
<?php $datestr = "2003, 1500, 310"; $datearr = explode(", ", $datestr); $h = substr($datearr[1], 0, 2); $m = substr($datearr[1], 2);
echo date ("m/d/Y H:i:s", mktime ($h,$m,0,1,$datearr[2],$datearr[0])) . "\n"; ?>
|
|
|
|
Joined: Jan 2003
Posts: 125
Journeyman
|
Journeyman
Joined: Jan 2003
Posts: 125 |
many thanks, thats perfect!
|
|
|
|
Joined: May 1999
Posts: 1,715
Addict
|
Addict
Joined: May 1999
Posts: 1,715 |
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 5,833
Joined: January 2000
|
|
Forums63
Topics37,573
Posts293,925
Members13,849
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|