473,382 Members | 1,752 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,382 software developers and data experts.

preg_split to split offset time from time

119 100+
Hi,

I have a string which will get the time with offset time. Since it is offset. I may require to split either using - or +. below is my code I tried so far.

Expand|Select|Wrap|Line Numbers
  1. $idealedt = $_REQUEST['committime']; // $idealdt = 03:45-05:00
  2. $mytime = preg_split('/[-\+]/',$idealedt);
  3.  
This is not working at all. not sure where it goes wrong. Can any one help me on framing this please.

Thanks in advance,
Magesh
Nov 26 '12 #1
3 1793
Rabbit
12,516 Expert Mod 8TB
Code works fine for me. Are you sure the string in $_REQUEST['committime'] is in the correct format?
Nov 26 '12 #2
phpmagesh
119 100+
Yes this is correct format. Simply the committime value will be like 05:35-05:00 or 05:35+05:00(HH:MM[-+]offset)
Nov 27 '12 #3
Rabbit
12,516 Expert Mod 8TB
Well, like I said earlier, the code works fine for me.
Nov 27 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Bart Nessux | last post by:
am I doing this wrong: print (time.time() / 60) / 60 #time.time has been running for many hours if time.time() was (21600/60) then that would equal 360/60 which would be 6, but I'm not getting...
2
by: engsol | last post by:
I'm using Python to parse a bunch of s/w test files and make csv files for later report generation by MS ACCESS....(my boss loves the quick turn-around compared to C). Each log file may contain one...
8
by: kwharrigan | last post by:
I am working on some code using python and a distributed system. Some particular message is sent on one machine (with a timestamp logged) and after the message is received, a timestamp is made. I...
8
by: peterbe | last post by:
What's the difference between time.clock() and time.time() (and please don't say clock() is the CPU clock and time() is the actual time because that doesn't help me at all :) I'm trying to...
8
by: flamesrock | last post by:
So, I was blazin' some mad chronix, as they say, and got on to thinking about Python. The question was, is the statement: time.time() < time.time() always true? Seems it should be false,...
9
by: Ron Adam | last post by:
I'm having some cross platform issues with timing loops. It seems time.time is better for some computers/platforms and time.clock others, but it's not always clear which, so I came up with the...
1
by: Nitro | last post by:
Hello, today I encountered a very odd situation. I am on Windows Vista and using Python 2.5.2. Here's a code snippet to illustrate my problem: # uncomment the next line to trigger the...
5
by: Nickolai Leschov | last post by:
Hello, I'm reading code for time function in glibc and I see the following fragment in file time\time.h: /* Return the time now, and store it in *TIMER if not NULL. */ time_t time (timer)...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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.