?
Solved

Getting 'fractional' seconds in date time for some reason... need to lose the extra 2 digits

Posted on 2014-04-14
2
Medium Priority
?
277 Views
Last Modified: 2014-04-14
Using codeigniter (though I suppose doesn't really matter).
I pass a user_id to my model to get the correct time for their timezone prior to inserting into my db. When I echo out what is being created, I get the extra 2 digits for some inexplicable reason:

2014-04-14 10:40:3024
//passing the user id
	public function get_time($user_id)
	{
		return $this->db
			->select('timezone')
			->from('user')
			->where('id', $user_id)
			->get()->row();
	}

Open in new window

Any idea what is going on and how I could correct this?
0
Comment
Question by:tjyoung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 2000 total points
ID: 39999143
Maybe coincidence but the last 2 digits are 24 - does this indicate the time format (12 or 24 hour)

Also, you have a couple of parts here that aren't really explained

Firstly, how is the date stored in your database (does it include the 24 part...is it stored in a date column).

Secondly, how are you echoing out the returned value - maybe it's just a formatting issue?
0
 
LVL 1

Author Closing Comment

by:tjyoung
ID: 39999238
Hi, your pointing out the 24 is what made my error click. I was echoing out the time and there wasn't an issue but... I was also returning the last inserted ID which happened to be 24. So it was being appended. Duh... kill me.
Thanks
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question