473,385 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Changing between times

hey
does anyone know to convert a time string in the form
dd-mm-yyyyThh:mm:ss i.e 2006-08-01T15:45:11-00:00 to a normal unix time
stamp or something that at least I can use to compare to a unix
timestamp.

Hope that makes sense

Aug 7 '06 #1
3 1391

Iain Adams wrote:
hey
does anyone know to convert a time string in the form
dd-mm-yyyyThh:mm:ss i.e 2006-08-01T15:45:11-00:00 to a normal unix time
stamp or something that at least I can use to compare to a unix
timestamp.

Hope that makes sense
$string = '2006-08-01T15:45:11-00:00';
$timestamp = strtotime($string);

Aug 7 '06 #2
Hey,

When I try that I unfortunetely get -1. Any other ideas?

ZeldorBlat wrote:
Iain Adams wrote:
hey
does anyone know to convert a time string in the form
dd-mm-yyyyThh:mm:ss i.e 2006-08-01T15:45:11-00:00 to a normal unix time
stamp or something that at least I can use to compare to a unix
timestamp.

Hope that makes sense

$string = '2006-08-01T15:45:11-00:00';
$timestamp = strtotime($string);
Aug 8 '06 #3
Rik
Iain Adams wrote:
ZeldorBlat wrote:
>Iain Adams wrote:
>>hey
does anyone know to convert a time string in the form
dd-mm-yyyyThh:mm:ss i.e 2006-08-01T15:45:11-00:00 to a normal unix
time stamp or something that at least I can use to compare to a unix
timestamp.

Hope that makes sense

$string = '2006-08-01T15:45:11-00:00';
$timestamp = strtotime($string);
When I try that I unfortunetely get -1. Any other ideas?
Don't you mean the datatimestring should be '2006-08-01T15:45:11' instead of
'2006-08-01T15:45:11-00:00'?

If yes:
list($date,$time) = explode('T',$string);
list($year,$month,$day) = explode('-',$date);
list($hour,$minute,$second) = explode(':',$time);
$time = mktime($hour,$minute,$second,$month,$day,$year);

If not:
list($date,$time) = explode('T',$string);
list($year,$month,$day) = explode('-',$date);
$time = substr($time,0,8);
list($hour,$minute,$second) = explode(':',$time);
$time = mktime($hour,$minute,$second,$month,$day,$year);

Grtz,
--
Rik Wasmus
Aug 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Shaiboy_UK | last post by:
Hi All, Sorry if this is the wrong newsgroup to post into, on this topic, if so, please point me in the right direction..... Currently working on a ASP for a friend, which requires the date...
2
by: Don | last post by:
is there any way to disable the controls on a form without changing their appearance? i would like to make it impossible for a user to click buttons and edit text boxes while the controls retain...
1
by: Sean | last post by:
i am writing a class that visual demonstrates the result of changing the quality of a jpeg. the intention is to do this by saving the file and a selected quality, then reloading it to get an idea of...
0
by: google | last post by:
I know this topic has been discussed many times all over the web but in my case although i can make it work in a normal window but it falls flat working in a window where i generate a PDF from a...
7
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
7
by: Brett Romero | last post by:
I'd like to copy a object1 into object2 so object2 can be manipulated. Object1 is coming form the middle layer into the UI layer. I'd like to rename a field in Object2 from "somethingID" to just...
15
by: phillip.s.powell | last post by:
<style> div div table tr td a.navbar, div div table tr td font {display: none;} </style> <div class="navigationbar" style="background-color:Black; position: absolute; left:50%; top:127px;...
34
by: samjnaa | last post by:
This is like the previous one. Please check for sanity and approve for posting at python-dev. I would like to have something like "option base" in Visual Basic. IIRC it used to allow me to...
1
by: 32Alpha | last post by:
Hi, first post here. First off, this IS a homework assignment for an operating systems class, but the question isn't "how do i do the assignment" but "why is my particular implementation not...
2
by: fairbanj | last post by:
I am using Windows Authentication and I am trying to determine how to swap users (like when a supervisor needs to temporarily boost the priviledges of a session by logging into his own account and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.