Uncaught Type Error: Object[object Object] has no method timepicker |
The order of priority must be the following:
jQuery.js
Everything that depends on jQuery.
It looks like you got that wrong (looking at your code in the question).
Change it to this:
<script
src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript"
src="js/jquery.timepicker.min.js"></script>
|
Object has no method 'Timepicker' |
Have you included your timepicker.js(whatever) before this code chunk and
after the UI core js? Basically you need to add the dependency first for
timepicker.js, then the timepicker js itself and then the code chunk.
Thanks.
|
i' m using Bootstrap Timepicker with twitter bootstrap but it doesn't shows the timepicker popup on clicking the timeicon |
You have to put the id on your parent div :
<div class="control-group">
<label class="control-label">Next Time</label>
<div class="controls">
<div id="timepicker1" class="input-append
bootstrap-timepicker">
<input type="text" class="input-small">
<span class="add-on"><i
class="icon-time"></i></span>
</div>
</div>
</div>
|
Datepicker and TimePicker in a form, datepicker works fine but timePicker doesn't drop down in field |
Based on your comment above, I would guess your code is not executing
because you have not included jquery.timePicker.js in your code. Download
the file and include it like this:
<script
src="path/to/your/js/file/jquery.timePicker.js"></script>
You don't need to include datePicker.js because datepicker is a plugin
included with the jquery-ui library. (So really you do have datepicker
included!)
Also, looking at your comment, you do not need to have a ; after declaring
a <script> tag
Like this:
<script></script>
Not like this:
<script></script>;
EDIT
I found the issue, it appears the jquery.timepicker.js library is quite old
(2009). It was developed with a much older jquery version. When I run
jquery.timepicker.js with a newer version of
|
Why method now in Python is obtained as datetime.datetime.now instead of datetime.time.now? |
"Now" is a point in time. That means date matters; if it's noon now,
yesterday noon is not also now. (Time of day also matters; 9 AM today is
also not now.) Thus, it makes sense to have a datetime.datetime.now, but
not a datetime.time.now. It could make sense to have a
datetime.time.currentlocaltime or datetime.time.currentutctime, but those
methods don't exist. You could put in a feature request if you want.
|
Different timezone_types on DateTime object |
Timezones can be one of three different types in DateTime objects:
Type 1; A UTC offset, such as in new DateTime("17 July 2013 -0300");
Type 2; A timezone abbreviation, such as in new DateTime("17 July 2013
GMT");
Type 3: A timezone identifier, such as in new DateTime( "17 July 2013", new
DateTimeZone("Europe/London"));
Only DateTime objects with type 3 timezones attached will allow for DST
correctly.
In order to always have type 3 you will need to store the timezone in your
database as accepted identifiers from this list and apply it to your
DateTime object on instantiation.
|
Using ToString on a DateTime object |
I think if you need to compare dates then you can just get a Date component
of a DateTime and compare it to your predefined value. This should be
faster as there won't be a need to transform date to string every time as
well. So you can first get your reference value like that
DateTime.ParseExact(value, "dd/MM/yyyy", CultureInfo.InvarianCulture). You
can just use a constructor of a DateTime to compose it as well.
|
get date from DateTime Object |
Use DateTime::format()
$dateTime = new DateTime('2013-08-12 00:00:00');
echo $datetime->format('Y-m-d'); // produces 2013-08-12
|
Creating DateTime object from string |
Have a look at DateTime.ParseExact()
http://msdn.microsoft.com/en-us/library/w2sa9yss.aspx
DateTime result=null;
CultureInfo provider = CultureInfo.InvariantCulture;
// Parse date and time with custom specifier.
string dateString = "Sun 15 Jun 2008 8:30 AM -06:00";
string format = "ddd dd MMM yyyy h:mm tt zzz";
try {
result = DateTime.ParseExact(dateString, format, provider);
Console.WriteLine("{0} converts to {1}.", dateString,
result.ToString());
}
catch (FormatException) {
Console.WriteLine("{0} is not in the correct format.", dateString);
}
|
Cannot convert DateTime object to string |
DateTime class has no magic method __toString(), so you cannot use this
object as string.
You should use getTimestamp()
$cdate = new DateTime("+7 months");
$expiry_date = $cdate->getTimestamp();
|
Convert datetime from xml to c# object using linq |
use XElement to DateTime conversion instead of Convert.ToDateTime:
XDocument xmldocument = XDocument.Load(xmlfile);
List<Client> clients = (from client in
xmldocument.Element("Clients").Elements("Client")
select new Client
{
Name = (string)client.Element("Name"),
Birthday =
(DateTime)client.Element("Birthday")
}).ToList();
|
DateTime object or date functions php |
there are lots of advantage to use datetime class instead of date function
in latest PHP version and some of them are below.
=> If it makes sense to use DateTime class in order to perform certain date
calculations, then use it. It's not expensive to the point where your app
will feel it, unless you do something crazy such as creating 1 million
DateTime objects.
=> DateTime is great is because it alleviates the worry of daylight savings
by specifying the time zone when creating the object. It's also easy to
obtain differences between dates or obtain intervals between different
objects. It basically cuts down the amount of worry and coding required
(but I will admit it is wrong sometimes, hopefully it'll get addressed in
5.4 release of PHP).
|
detect if a variable is a datetime object |
You need isinstance(variable, datetime.datetime):
>>> import datetime
>>> now = datetime.datetime.now()
>>> isinstance(now, datetime.datetime)
True
|
How can i define a datetime object in Python? |
As the document says, the construction method is as following:
datetime(year, month, day[, hour[, minute[, second[,
microsecond[,tzinfo]]]]])
And the datetime.MINYEAR is 1, which means the minimum year value is 1. So
you can not define a datetime to be equal to Zero. With your method:
time1 = datetime.now();
time1 -= time1;
The object time1 is changed to be datetime.timedelta not datetime.datetime
object.
>>> time1 = datetime.datetime.now();
>>> time1
datetime.datetime(2013, 6, 9, 11, 13, 3, 57000)
>>> type(time1)
<class 'datetime.datetime'>
>>> time1 -= time1;
>>> time1
datetime.timedelta(0)
>>> type(time1)
<class 'datetime.timedelta'>
Thanks to @falsetru, the method to define a timedelta as zero, we should do
as
|
How to remove year from datetime object? |
Use the standard ToString date formatter, with capital MM meaning "month
month" and lower-case dd "day day"
row.Cells[2].Text = dt.ToString("MM/dd");
|
How to get rough age of a timestamp/datetime object? |
if you have 2 objects. You need to convert first object to timestamp and
second object is time();
time() - Returns the current time measured in the number of seconds since
the Unix Epoch (January 1 1970 00:00:00 GMT).
Then you substract time() with date you want and you get difference in
seconds. To make minutes from seconds you need divide it by 60, to make
hours you need to divide it by 60 * 60 = 3600 etc.
$secondsAgo = time() - $timeStamp;
$minutesAgo= (time() - $timeStamp) / 60;
$hoursAgo= (time() - $timeStamp) / 60*60;
$daysAgo= (time() - $timeStamp) / 60*60*24;
To change string to timestamp you can use strtotime()
The other solution is to use diff() on DateTime object.
$datetime1 = new DateTime('2009-10-11');
$datetime2 = new DateTime('2009-10-13');
$interval = $dat
|
convert string contains +GMT date to datetime object |
DateTime dt = DateTime.ParseExact(
date, "yyyyMMddHHmmsszzz", null, DateTimeStyles.None);
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
|
how make a datetime object in year 0 with python |
from the docs
The datetime module exports the following constants:
datetime.MINYEAR The smallest year number allowed in a date or
datetime object. MINYEAR is 1.
datetime.MAXYEAR The largest year number allowed in a date or datetime
object. MAXYEAR is 9999.
|
How to create datetime object from "16SEP2012" in python |
Use datetime.datetime.strptime:
>>> datetime.datetime.strptime('16Sep2012', '%d%b%Y')
datetime.datetime(2012, 9, 16, 0, 0)
|
How to parse a datetime string to date object |
public class Example
{
public static void Main()
{
string[] dateStrings = {"2008-05-01T07:34:42-5:00",
"2008-05-01 7:34:42Z",
"Thu, 01 May 2008 07:34:42 GMT"};
foreach (string dateString in dateStrings)
{
DateTime convertedDate = DateTime.Parse(dateString);
Console.WriteLine("Converted {0} to {1} time {2}",
dateString,
convertedDate.Kind.ToString(),
convertedDate);
}
}
}
// These calls to the DateTime.Parse method display the following output:
// Converted 2008-05-01T07:34:42-5:00 to Local time 5/1/2008 5:34:42 AM
// Converted 2008-05-01 7:34:42Z to Local tim
|
How can I query a date from a datetime object in SQLite? |
You must not surround the date function with single quotes, which are
string delimiters.
What you have in the SQL statement is the string date(, the numbers 2013,
07, and 08, which are subtracted from each other, and the string ).
The function date converts the string 2013-07-08 into the string
2013-07-08.
Comparing that to the string 2013-07-08 09:08:51 will fail.
You want to strip the time from the string that has the time fields:
SELECT *
FROM geninfo
WHERE DeviceTag = ?
AND date(timestamp) = '2013-07-08'
|
Convert string to datetime.time object |
Use datetime.strptime() to get a datetime, and then the time() method to
get the time.
|
Can a datetime.date object without the day be created in python? |
Unfortunately, you can't pass 0 because there is no month 0 so you'll get
ValueError: month must be in 1..12, you cannot skip the month or the day as
both are required.
If you do not know the exact year or month, just pass in 1 for the month
and day and then keep only the year part.
>>> d = datetime.date(year=1940, month=1, day=1)
>>> d
datetime.date(1940, 1, 1)
>>> d.year
1940
>>> d = datetime.date(year=1940, month=1, day=1).year
>>> d
1940
The second statement is a shorthand for the first.
However, if you want to just store the year, you don't need a datetime
object. You can store the integer value separately. A date object implies
month and day.
|
Query a DATETIME object for items from last week |
Using strftime you can retrieve the day of week. So subtracting that number
from the current date will give you last Sunday's date (or today if it's
Sunday).
select date('now' , (select '-' || strftime('%w', date('now')) || ' days'))
You can use this as a base for going back even further. For example, this
query will give you the date of the Sunday before the most recent Sunday.
select date('now' ,
(select
'-'
|| (cast(strftime('%w', date('now')) as integer) + 7)
|| ' days'
))
So with some basic maths you can build the date range you want.
|
SOAP deserialization of DateTime object with value "0000-00-00" fails |
your best choice would be to generate the client side by hand (or using
Svcutil tool)
and modify the contract to receive a message, instead of datetime. that way
you could interact with the message itself and handle the invalid date-time
values. there is a nice post about using the feature here more about Using
Message Contracts on msdn.
|
Parsing date, time and zone to UTC datetime object |
Using timezone.localize:
>>> from datetime import datetime
>>> from pytz import UTC, timezone
>>>
>>> CET = timezone('CET')
>>>
>>> a = datetime.strptime('16:18:57.925 Wed Sep 11 2013',
'%H:%M:%S.%f %a %b %d %Y')
>>> print CET.localize(a).astimezone(UTC)
2013-09-11 14:18:57.925000+00:00
|
Given a dateTime object in C#, show date according to computer locale? |
DateTime.ToString() without parameters actually uses the current culture.
So the output of .ToString() will be different on multiple machines,
depending on their culture.
|
Symfony2: Object of class DateTime could not be converted to string |
Looks like problems in your validators. Possible that is validators.yml
cause I dont see validation annotations on entity. You trying to validate
DateTime with NotBlank validator which trying to show you error. Change it
to NotNull validator.
'C:xampphtdocsPhpProject1vendorsymfonysymfonysrcSymfonyComponentTranslationTranslator.php',
'188', array('id' => 'This value should be blank.', 'parameters' =>
array('{{ value }}' => object(DateTime)), 'domain' => 'validators',
'locale' => 'en'))
at strtr ('This value should be blank.', array('{{ value }}' =>
object(DateTime)))
|
DateTime object creation on MySQL non null field |
$formatted_date = "";
if($data['row'] != "0000-00-00 00:00:00")
{
$date = new DateTime('0000-00-00 00:00:00');
$formatted_date = $date->format('Y-m-d');
}
echo $formatted_date;
|
MongoDB difference between DateTime object and YYYY-MM-DD string |
The advantage of DateTime is a few bytes less on disk. bson stores DateTime
as an integer, but "2013-08-31" is a string, at 20 bytes right there.
ISO-8601 (http://www.w3.org/QA/Tips/iso-date) is meant for being able to
sort quickly.
In this case, I would always store as datetime.
edit: How time-consuming are you seeing this string-to-datetime conversion?
Are you sure that is your bottleneck? I have a hard time believing the
conversion is taking as long as you claim.
|
Parsing a string into a DateTime object and adding minutes in Ruby |
what about? as long as you're using activesupport of course
text_t = "1:00 PM ET"
text_next = DateTime.strptime(text_t, '%I:%M %p %Z')
text_next = text_next + 30.minutes
|
Serialization of a .net DateTime object parsed from an SQL Server database to JSON String |
Looks like it's really a gotcha in DataContractJsonSerializer. You can try
to implement what this guy did here. Or this answer for a similar question
raised before.
|
How should look link the json response so that ActiveResource may generate a DateTime object from a date? |
JSON will always be a string as this is how it passes data as stringyfied
objects. If you want to convert it to a date/time object you will need to
parse it at the server side.
Time.parse should do the trick
http://ruby-doc.org/stdlib-2.0/libdoc/time/rdoc/Time.html#method-c-parse
|
TimePicker and DatePicker |
You can set it callback method onDateSet/onTimeSet.
If by textField, you mean textView/EditText in your xml layout.
((TextView)findViewById(R.id.myTextField)).setText(FORMATTED_DATE);
For formatting, you can do something like this
String.format("%d-%d-%d",day,month,year)
Something lke that
|
TimePicker + CheckBox |
Here's an functional example with all your requirements.
Tested and 100% functional :)
Put this in xml:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
>
<TextView
android:id="@+id/timer_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Check this to Cancel Alarm"
android:layout_above="@+id/time_picker"
android:layout_toRightOf="@+id/time_pic
|
WPF- TimePicker is not updating |
Xaml-
<Grid>
<xctk:TimePicker Name="StartPicker"
TextBoxBase.TextChanged="StartPicker_TextChanged" Value="{Binding
StartTimeBinding, ElementName=MainWin,
UpdateSourceTrigger=PropertyChanged}" Format="Custom" FormatString="hh:mm
tt" Background="Yellow" Padding="0" Margin="0" BorderThickness="0"
Width="100" Height="50" EndTime="11:59:0"/>
<xctk:TimePicker Name="EndPicker"
TextBoxBase.TextChanged="EndPicker_TextChanged" Value="{Binding
StopTimeBinding, ElementName=MainWin1,
UpdateSourceTrigger=PropertyChanged}" Format="Custom" FormatString="hh:mm
tt" Background="Yellow" Padding="0" Margin="0" BorderThickness="0"
Width="60" Height="50" EndTime="11:59:0"/>
</Grid>
Code-Behind your Xaml in Xaml.cs
private void EndPicker_Text
|
Why is my second "timepicker" not being populated? |
Make sure that you initialize both occurrences of the $.timeEntry() fields
like so:
// Start Date / Time
var beginDatepickerOpts = {
...
}
$('#BeginTime').timeEntry(); // Initialize the BeginTime TimeEntry Field
$("#BeginDate").datepicker(beginDatepickerOpts);
// End Date / Time
var endDatepickerOpts = {
...
}
$('#EndTime').timeEntry(); // Initialize the EndTime TimeEntry Field
$("#EndDate").datepicker(endDatepickerOpts);
EXAMPLE
JSFiddle Example Here.
|
How can I add Seconds to my "timepicker"? |
Just go to the link and you will get the required stuff.
http://www.avisbra.it/wp-content/plugins/lbwp_book/js/jquery/plugin/timepicker/
|
Bootstrap Jquery Timepicker |
You are not connected to plugin js files. it will not work without
including needed external Resources.
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.8.3.js'></script>
<link rel="stylesheet" type="text/css"
href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap.min.css">
<script type='text/javascript'
src="http://www.eyecon.ro/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<link rel="stylesheet" type="text/css"
href="http://www.eyecon.ro/bootstrap-datepicker/css/datepicker.css">
Please check this working example with your code.
Fiddle
add needed external resources.
|
accessing TimePicker value in Javascript |
This should work:
function getTime(timePicker) {
var timeSel = document.getElementById(timePicker);
var inputs = timeSel.getElementsByTagName("input");
if (inputs.length === 6) {
var hour = inputs[0].value;
var minutes = inputs[2].value;
var seconds = inputs[4].value;
var meridiem = inputs[5].value;
return hour + ":" + minutes + ":" + seconds + " " + meridiem;
}
}
Usage:
var time = getTime('<%=TimeSelector1.ClientID %>');
console.log(time);
Note: Make sure this is included after the elements are loaded
(window.load, document.ready or at the bottom of your page, after body
tag).
Result: 02:14:00 PM
This, of course is a string, but you can easily turn that into a Date
object:
return new Date(null, null, null, hour, minu
|