Solved

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

Posted on 2014-04-14
2
274 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
2 Comments
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Creating and Managing Databases with phpMyAdmin in cPanel.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

713 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