First of all, you're interpreting the debugger incorrectly. This is not the error message: When converting string to DateTime, parse the string to take the date before putting each variable into the DateTime object. Notice how it's listed as "Troubleshooting Tips". In the vast majority of cases, you can ignore...
I took your code, and it seems like the main issues are in the append_to_database function. It looks like the return value of normalise_date_to_UTF returns a datetime object, which is being passed to append_to_database (as the timestampval argument), and that is being run through strptime, which is unnecessary since it's...
Try this. You should have the date in the correct format. var dateTime = new Date("2015-06-17 14:24:36"); dateTime = moment(dateTime).format("YYYY-MM-DD HH:mm:ss"); ...
database,datetime,cakephp,insert
Your problem is in view :) Change report to Report. Now when you are saving $this->request->data its trying to find Report key to be able to save , or report field in your database. If you dont want change this , in controller you can save $this->request->data['report'] Edit Also if...
Isn't this wrong? why did the converted time increase by an hour on 1st November? Because that's when the clocks change, as you say. The problem is that "2015-11-01 01:49:00.000" is ambiguous in Pacific Time - it occurs twice, once at 2015-11-01T08:49:00Z and once at 2015-11-01T09:49:00Z. A DateTime can...
While you declared the variable averMen, you have not initialized it. The query which should be calculating averMen is calculating averWomen instead. Try changing ... SELECT AVG(DATEDIFF(BIRTH_DATE,CURDATE())) INTO averWomen FROM PLAYERS WHERE sex = 'M'; into SELECT AVG(DATEDIFF(BIRTH_DATE,CURDATE())) INTO averMen FROM PLAYERS WHERE sex = 'M'; ...
using sql server WITH cteEvents AS ( SELECT CONVERT(VARCHAR,event_timestamp,101) event_date, RANK()OVER(ORDER BY CONVERT(VARCHAR,event_timestamp,101) DESC) rnk FROM events WHERE event_timestamp BETWEEN '01-Jun-15 11:14:40 AM' AND '11-Jun-15 11:14:40 AM' GROUP BY CONVERT(VARCHAR,event_timestamp,101) ) SELECT event_date, (SELECT event_date FROM cteEvents WHERE rnk = 2), (SELECT event_date FROM cteEvents WHERE rnk = 1) FROM...
ruby-on-rails,mongodb,datetime
You ask for Datetime, but maybe my answer (using Date type) can lead you the way too. Let's see. This answer suggests the Best way to store date/time in mongodb. That is if you can you should choose native JavaScript Date objects. The way I solve my issue (with Date...
If you follow through the reference source you'll see that DateTimeFormatInfo is extracted from your CultureInfo by simply referencing CultureInfo.DateTimeFormat. There is a Calendar property on DateTimeFormatInfo, which is what is used in parsing. These two are normally the same (i.e. reference equal), the fact you Clone your CultureInfo results...
javascript,jquery,datetime,time
Solution based on your code: function formatDate(raw_date){ var year = raw_date.substring(0,4); var month = raw_date.substring(5,7); var day = raw_date.substring(8,10); var right = raw_date.substring(10); var hours = ((right.substring(0,3))% 12 ); var min = raw_date.substring(14,16); var suffix = right.substring(0,3) >= 12 ? "PM":"AM"; return day + "/"+month+"/"+year+" "+hours + ':' + min...
javascript,python,json,datetime
There are likely other solutions, but json.load & json.loads both take an object_hook argument1 that is called with every parsed object, with its return value being used in place of the provided object in the end result. Combining this with a little tag in the object, something like this is...
getTimezoneOffset returns the offset for the specific moment in time represented by the Date object it is called on, using the time zone setting of the computer that it executing the code. Since many time zones change their offset for daylight saving time, it is perfectly normal for the value...
There are six columns, but only fix titles in the first line. This is why the parse_dates failed. you can skip the first line: df = pd.read_csv("tmp.csv", header=None, skiprows=1, parse_dates=[5]) ...
You may use the static method of createFromFormat() of the DateTime class: <?php $date = DateTime::createFromFormat('d/m/Y H:i A', '30/06/2015 02:04 PM'); $timestamp = $date->getTimestamp(); // 1435665840 ?> ...
Why don't you put your condition before conversion? $cur_time = time(); $db_time = $rs[$k]['update_time']; $diff = abs($cur_time - $db_time); if($diff > 3000) // 3600 is 1 hour and 3000 is 50 minutes { $msg = 'greater'; } else { $msg = 'lesser'; } Even if the time difference is 1...
I agree with Moritz that using Joda Time would make the code simpler, but you should be able to do all of this much more simply than your current approach: public String getTimeRelativeToDevice(String pstTime) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a", Locale.US); sdf.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles")); Date parsed = sdf.parse(pstTime); sdf.setTimeZone(TimeZone.getTimeZone("Europe/London")); return...
php,regex,datetime,syntax,sscanf
Like @LucasTrzesniewski pointed out, that's sscanf() syntax, it has nothing to do with Regex. The format is explained in the sprintf() page. In your pattern "%4d%[^\\n]", the two \\ translate to a single backslash character. So the correct interpretation of the "faulty" pattern is: %4d - Get four digits. %[^\\n]...
Is this what you are looking for? SELECT <choose your columns here> FROM Orders o LEFT JOIN XrefOrdersStatuses x ON x.xos_order_id = o.order_id LEFT JOIN (SELECT xos_order_id, MAX(xos_datetime) AS maxdate FROM XrefOrdersStatuses GROUP BY xos_order_id ) xmax ON xmax.xos_order_id = x.xos_order_id AND xmax.maxdate = x.xos_datetime; The LEFT JOIN is only...
python,csv,datetime,python-3.x
Once you have both the values in two variables, new_date and new_time, you could simply combine them to get the datetime, like this, >>> new_date = dt.datetime.strptime(row[0], "%Y.%m.%d") >>> new_time = dt.datetime.strptime(row[1], "%H:%M").time() >>> >>> dt.datetime.combine(new_date, new_time) datetime.datetime(2005, 2, 28, 17, 38) Note:- Avoid using date and time as variable...
datetime,jinja2,ansible,ansible-playbook
Ansible already knows about the date/time. - name: myTask shell: echo "123" > /tmp/{{ ansible_date_time.date }}_{{ ansible_date_time.hour }}-{{ ansible_date_time.minute }}-{{ ansible_date_time.second }}.zaz See this page for a list of default systems facts....
=month(A1*1) works because, as you guessed, the *1 turns the text into a number. I think the problem may be rooted in the format of the file you are importing. There may be non-printing characters in it? Or maybe it's an issue caused by US / European dates (this is...
android,datetime,timezone,jodatime
The solution i have found: in your application class, or somewhere else, initialise JodaTimeAndroid: JodaTimeAndroid.init(this); after this initialisation the date will be automatically converted to your zone, with proper offset. This is how you parse the data then: private static String FORMAT_DATE_SERVER = "yyyy-MM-dd'T'HH:mm:ssZ"; private static String raw_date = "2015-06-18T08:52:27Z";...
Use Python's isinstance() or issubclass()
First, you do not need nested select for what you are doing. So: SELECT (SELECT DATEADD(mi, left(@off,1)+(convert(int, SUBSTRING(@off,2,2)*60) + convert(int,RIGHT(@off,2))), @d)) as 'UTC-calc', is the same as: SELECT DATEADD(mi, left(@off,1)+(convert(int, SUBSTRING(@off,2,2)*60) + convert(int,RIGHT(@off,2))), @d)) as [UTC-calc], The problem is that the string + or - converts to 0 in an...
A format function that can return many different formats, can be expected to be quite slow. If you are happy with lubridate's year function, you could just use its (very simple) code: as.POSIXlt(x, tz = tz(x))$year + 1900 In general, you should avoid conversions between any types/classes and characters when...
While you don't say what your timezone is, this looks like Daylight Saving Time (DST) issue. In timezones that use DST, there will be a day where the hour "jumps" from 1:59:59.999 to 3:00:00.000. This means that any times in the 2AM hour do not exist on this day. My...
You can use dateutil by installing pip install python-dateutil Then >>>from dateutil import parser >>>mydate = "June 3, 2001" >>>str(parser.parse(mydate).date()) '2001-06-03' ...
Maybe this (Difference between DateTime in c# and DateTime in SQL server) will help a little. you can also use Datetime2 for SQL...
With ParseExact(): using System.Globalization; var value = "Mon Jun 15 2015 00:00:00 GMT+0200 (Central Europe Daylight Time)"; var trimedValue = value.Substring(0, value.IndexOf(" (")); var dateTime = DateTime.ParseExact(trimedValue, "ddd MMM dd yyyy HH:mm:ss 'GMT'zzz", CultureInfo.InvariantCulture); ...
c#,asp.net-mvc,datetime,entity-framework-6
You need to first materialize the query to your application and then parse it. Entity Framework doesn't know how to execute dot Net methods, it only knows how to translate them to SQL
json,angularjs,date,datetime,angularjs-ng-repeat
You could pass the date string to the Date Object Put this in your controller: myApp.controller("MyPersonController", function($scope){ for (var i in $scope.persons) { $scope.persons[i].Date = new Date($scope.persons[i].Date); } }); If you have problems with formatting, I would recommend a date wrapper like MomentJs...
postgresql,datetime,translation,intervals,postgresql-8.4
I think no. sorry. day, month etc are field in type interval. it will be in English. like you don't expect use "vybrac" instead of select :) But you can have locale in time values, yes. td=# set lc_time TO pl_PL; SET td=# SELECT to_char(to_timestamp (4::text, 'MM'), 'TMmon'); to_char ---------...
python,python-2.7,csv,datetime
Use datetime.timedelta() objects to model the durations, and pass in the 3 components as seconds, minutes and hours. Parse your file with the csv module; no point in re-inventing the character-separated-values-parsing wheel here. Use a dictionary to track In and Out values per user; using a collections.defaultdict() object will make...
When you substract two datetimes, you'll get the difference in days, not hours. You get a Rational type for the precision (some float numbers cannot be expressed exactly with computers) To get a number of hours, multiply the result by 24, for minutes multiply by 24*60 etc... a = DateTime.new(2015,...
mm is for minutes. Use: upcomingMonday.ToString("MM.dd.yy") MM gets the month, padded with a 0 if necessary (January => 01, December => 12). See Custom Date and Time Format Strings from MSDN....
python,regex,algorithm,python-2.7,datetime
What about fuzzyparsers: Sample inputs: jan 12, 2003 jan 5 2004-3-5 +34 -- 34 days in the future (relative to todays date) -4 -- 4 days in the past (relative to todays date) Example usage: >>> from fuzzyparsers import parse_date >>> parse_date('jun 17 2010') # my youngest son's birthday datetime.date(2010,...
From here: The first parameter to NVL is determining the expected datatype of the returned column, with the trunc function defaulting that to NUMBER because it's parameter is NULL. The second parameter to NVL needs to match that datatype which it doesn't because it is a date. SQL> select nvl(trunc(sysdate),...
With row_number function: with cte as(select *, row_number() over(partition by event_id order by event_timestamp desc) rn from events) select * from cte where rn <= 2 ...
Yes it is but this is happening in a different module. I don't even understand what is that mean. I think you just need; DateTime dtchk = dt; Nothing more. But anyway.. I try to explain; Since "D" format specifier generates string representation with leading zeros if your string...
sql-server,date,datetime,sql-server-2014
You need to determine the format of the value you are converting before you can convert it. If it's simply between those two formats, you can simply search for - to determine it's format. I would also suggest storing the value in a datetime column as opposed to a varchar,...
sql,postgresql,datetime,timezone,date-arithmetic
Answer for timestamp You need to understand the nature of the data types timestamp without time zone and timestamp with time zone (names can be deceiving). If you don't, read this first: Ignoring timezones altogether in Rails and PostgreSQL The AT TIME ZONE construct transforms your timestamp to timestamptz, which...
You can select in a range of hours by... SELECT * FROM orktape WHERE HOUR(mytimestamp) >= 17 AND HOUR(mytimestamp) < 19 Not sure what your timestamp column is called, I would not call it timestamp, that could be confusing....
You could pass a float to the Decimal constructor directly: d = Decimal(stamp) CPython float uses C double that has more than enough precision to represent microseconds in the usual timestamp range. time.time() and datetime.utcnow() may produce slightly different results. The latter is rounded to microseconds: from datetime import datetime...
Why not just put them into a dict, that way you'll only get one entry per every minute: times = [ '2015-06-18 11:36:57.830000', '2015-06-18 11:36:57.830000', '2015-06-18 11:36:59.340000', '2015-06-18 11:36:59.340000', ] time_dict = {} for time in times: time_dict[(time.split('.'))[0][:-3]] = 1 print(time_dict.keys()) Even better, you could create the dict before you...
You should not use Convert.ToDateTime like that. You should use DateTime.Parse or DateTime.ParseExact. DateTime temp = DateTime.ParseExact(time, "yyyy-MM-dd hh:mm:ss tt", CultureInfo.InvariantCulture); Since DateTime.Parse(temp) worked for you, you can leave it as that. Edit: The difference between the two methods is very important in this situation. Convert.ToDateTime(s) This method will call...
As @Rawling correctly noted, you're parsing the datetime twice: first, using your custom formatting, and second, using the system's default formatting. This is silly - you already have the DateTime from the ParseExact method: string str = "27-07-2015 6:15 pm"; var dt = DateTime.ParseExact(str, "dd-MM-yyyy h:mm tt", null); That's it,...
Try the following (note lower case 'y'): date_format = '%m/%d/%y' %Y is for a four digit year, and %YY would be for a four digit year ending in 'Y', e.g. '2015Y'. s = '05/29/15' >>> dt.datetime.strptime(s, '%m/%d/%y').date() datetime.date(2015, 5, 29) ...
sql,datetime,ms-access,ddl,create-table
Time and procedure are reserved words, and therefore should be escaped: Create Table Appointments (DocID char(4) not null primary key, PatID char(8) not null, [Day] varchar(8) not null, [Time] datetime not null, [Procedure] varchar(50) null); Or better yet, find names that aren't reserved words: Create Table Appointments (DocID char(4) not...
Instead of assigning the tzinfo parameter, use the localize method from pytz. tz = get_localzone() date = tz.localize(datetime(2015, 6, 17, 14, 58, 45)) This is discussed prominently in the pytz documentation, starting with the the first "Note" box, and in the very first code sample. It's also shown in the...
The precision must be given only for the output. For parsing, the seconds (or the timestamp) are treated as floating numbers. But reading in a time stamp with milliseconds seems to be supported only since version 4.6.4 (tested here). But, there is a workaround: specifying ($1) instead of 1 in...
c#,datetime,timezone,datetime-conversion
From this link; !!! Note: Currently FLE Summer Time is observed. And this says it is UTC+3 currently. That's why it's too normal to get 3 hour differences when you calculate them. As Hans Passanst says, when you write Google as Local time in Kyiv or Local time in Riga,...
For the sqlite issue, you need to have whitespace between column names and types. For example, change TaskEntry.COLUMN_TASK_DUE + "DATETIME, " + to TaskEntry.COLUMN_TASK_DUE + " DATETIME, " + There's a similar problem with almost all of your columns. After fixing the CREATE TABLE SQL, uninstall and reinstall your app...
python,datetime,pandas,timezone
The middle line is how I've converted timezones in pandas: df['time'] = pd.to_datetime(df['time'], unit='s') df = df.set_index('time').tz_localize('US/Eastern').tz_convert('UTC').tz_convert(None).reset_index() df['time'] = df['time'].dt.date ...
Just cast it to a date: select sum(use), localminute::date from tablename group by localminute::date; or using standard SQL: select sum(use), cast(localminute as date) from tablename group by cast(localminute as date); ...
python,parsing,datetime,pandas,dataframes
Instead of using to_datetime(), first parse your strings with dateutil.parser.parse(): In [2]: from dateutil.parser import parse In [3]: dt1 = "Tue Nov 4 12:01:15 2014" In [4]: dt2 = "2014-11-04 13:15:13 +0000" In [5]: parse(dt1) Out[5]: datetime.datetime(2014, 11, 4, 12, 1, 15) In [6]: parse(dt2) Out[6]: datetime.datetime(2014, 11, 4, 13,...
You have to take the first 14 characters, from the example above: print convert(datetime,stuff(stuff(stuff(LEFT('20150614140520-0500',14) , 9, 0, ' '), 12, 0, ':'), 15, 0, ':')) ...
Try this datetime.strptime (time , "%Y-%m-%d %H:%M:%S.%f %Z") "%f" is for anything that comes after the seconds. It will give the microseconds and "%Z" will give the the time zone...
jquery,asp.net-mvc,datetime,momentjs,globalization
Default model binder in asp.net mvc is aware of date localization issues. To make it parse date in specified culture, you need to set CurrentCulture before action method is called. I am aware of few possible ways to do this. Globalization element Globalization element can automatically set CurrentCulture to user's...
sql-server,sql-server-2008,date,datetime
With FULL JOIN: DECLARE @t1 TABLE ( col1 VARCHAR(20) , col2 VARCHAR(20) , col3 DATE ) INSERT INTO @t1 VALUES ( 'a', 'ab', '2015-05-01 00:00:00.000' ), ( 'as', 'as', '2015-05-01 00:00:00.000' ), ( 'as', 'asasd', '2015-05-01 00:00:00.000' ), ( 'asd', 'aa', '2015-05-02 00:00:00.000' ), ( 'asd', 'asd', '2015-05-04 00:00:00.000' )...
php,arrays,sorting,datetime,laravel
You can use Laravel's collection groupBy method to group your records for your needs. $records = YourModel::all(); $byHour = $records->groupBy(function($record) { return $record->your_date_field->hour; }); $byDay = $records->groupBy(function($record) { return $record->your_date_field->dayOfWeek; }); Remember that this code to work, you have to define your date field in the $dates Model array, in...
sql,sql-server-2008,date,datetime,visual-studio-2008
Use datepart year, so your not performing a search on a function I'd reccomend setting up some variables that wil beset prior to the main query running, so your sarg is against a date. declare @fiscalStart = select cast('07/01/' + Cast((datepart(year, getdate())-1) as varchar(4)) as datetime) declare @fiscalEnd = select...
The month parameter to the Date constructor is 0 indexed, so 5 is June, which only has 30 days.
php,datetime,paypal,paypal-ipn
If you remove (Azores Standard Time) your date will become valid, and then you can use strtotime() or DateTime: $string = 'Mon Jun 15 2015 12:04:00 GMT+0600 (Azores Standard Time)'; $string = substr($string, 0, strrpos($string, '(') - 1); $dt = new DateTime($string); echo $dt->format('c \o\r U'); demo...
System.Globalization.DateTimeFormatInfo.InvariantInfo doesn't contain format pattern dd-MM-yyyy(26-06-2015) From MSDN about InvariantCulture The InvariantCulture property can be used to persist data in a culture-independent format. This provides a known format that does not change For using invariant format in converting string to DateTime your string value must be formatted with one of...
var h = 13, m = 14, s = 24; var secsSinceMidnight = (h*3600) + (m*60) + s; var oneTwelth = secsSinceMidnight / 12; h = Math.floor(oneTwelth / 3600); m = Math.floor( (oneTwelth % 3600) / 60); s = Math.floor( (oneTwelth % 3600) % 60); console.log(h + ":" + m...
This picker might suit your needs, further answers can be found regarding this familiar question.
oracle,function,datetime,toad,to-date
You're either relying on implicit date conversions or implicit format models; since you said you're using to_date and to_timestamp it seems to be the latter. You haven't shown your code but the error implies you're calling those functions with a string value in the format you expect to see, but...
I have to admit the date/time functions in PHP are a bit cumbersome. That is the reason I always work with the Carbon toolbox when working with dates and times. And if you are using composer, including it is as easy as typing composer require nesbot/carbon in your console. It...
DateTime.Parse uses standard date and time format of your CurrentCulture. Since your string has ( and ), you need to use custom date and time parsing with TryParseExact method (or ParseExact) with an english-based culture (eg: InvariantCulture) like; string s = "11 Jun 2015 (12:10)"; DateTime dt; if(DateTime.TryParseExact(s, "dd MMM...
Assuming that your time zone is US/Eastern (based on your dataset) and that your DataFrame is named df, please try the following: import datetime as dt from time import mktime import pytz df['Job Start Date'] = \ df['Job Start Date'].apply(lambda x: mktime(pytz.timezone('US/Eastern').localize(x) .astimezone(pytz.UTC).timetuple())) >>> df['Job Start Date'].head() 0 993816000 1...
javascript,regex,date,datetime
There are at least 2 issues with the regex: It has unescaped forward slashes The hyphen in the character classes is unescaped and forms a range (matching only . and /) that is not what is necessary here. The "fixed" regex will look like: /^\d{2}[.\/-]\d{2}[.\/-]\d{4}$/ See demo However, you cannot...
In this case the problem is caused becaus variables are case-sensitive, so $checkIndate and $checkInDate are two different variables. Correct this and you should be fine.
To make a DateTime store a UTC value, you must assign it a UTC value. Note the use of DateTime.UtcNow instead of DateTime.Now: DeliveryExpirationRepository.Add(new DeliveryPendingConfirmation { EmailConfirmationId = newGuid, DeliveryDate = DateTime.UtcNow.AddHours(48), }); The DateTime.UtcNow documentation says: Gets a DateTime object that is set to the current date and time...
java,loops,datetime,iterator,jodatime
I have implemented a solution for practicing the Joda library: public class JodaDateTimeExercise { private static final String PATTERN = "MMM $$ HH:mm"; public static void main(String[] args) { DateTime dateTimeBegin = new DateTime(2000, 3, 1, 3, 0); DateTime dateTimeEnd = dateTimeBegin.plusMinutes(239); DateTime dateTimeBeginCopy = dateTimeBegin; DateTime dateTimeEndCopy = dateTimeEnd;...
If dates are in YYYY-mm-dd format then you can use it as below otherwise you need to change the format. You can do as below : $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db('foo', $link); if (!$db_selected) { die ('Can\'t...
A DateTime value has no format. The format is only significant when you represent the value as a string. In other words, the requirements that it be formatted as "CCYY-MM-DDThh:mm:ss.sss-hh:mm" and that it not be a string are mutually exclusive. If it really needs to be a DateTime, you should...
python,string,perl,date,datetime
Here is the perl code that I think will work for you. #!/usr/bin/perl my $string = <STDIN>; chomp $userword; # Get rid of newline character at the end @arr = $string =~ /(passed|failed).+?([\d]+[yY].)?([\d]+(?:mo|MO).)?([\d]+[dD].)?([\d]+[hH].)?([\d]+[mM].)?([\d]+[sS])/g; $arr_len = scalar @arr; print "Result: $arr[0]\n"; for($i=1;$i<=$arr_len;$i=$i+1){ $arr[$i]=~/(\d+)([A-Za-z]*)/g; if ( $2 eq "y" | $2 eq...
You can use order by, where and limit for this calculation. I imagine it would work like this: select p.* from products p where prod_name = 'prod A' and prod_deadline <= now() order by prod_deadline desc limit 1 You may need like rather than = for the product name....
From the documentation on tm we can see that: tm_year is years since 1900, not the current year number, i.e. it should be 115 this year. tm_mon is months since January (range 0-11), not the number of the month. So what you need is: std::cout << 1900 + nowTm->tm_year <<...
jquery,asp.net-mvc,google-chrome,datetime,data-annotations
The specifications for the HTML5 date picker state that the date must be in the format yyyy-MM-dd (ISO format). This means that you DisplayFormatAttribute must be [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyInEditMode = true)] public string MyDate { get; set; } Alternatively you can manually add the format using @Html.TextBoxFor(m => m.MyDate,...
You are correct that the default short-date format for en-CA was changed, as of .NET 4.0. You can test this yourself: Console.WriteLine(new CultureInfo("en-CA").DateTimeFormat.ShortDatePattern); Running on .NET 2 runtime (framework 2.0/3.x) will give "dd/MM/yyyy". Running on .NET 4 runtime (framework 4.x) will give "yyyy-MM-dd". This is described in the MSDN document:...
c#,sql-server,asp.net-mvc,datetime,timezone
Is it possible that the incorrect result is actually on your machine and not Azure, and is because you are initialising ScheduledDateUtc as local time and not UTC? Consider these two lines of code: new DateTime(2015, 6, 1, 1, 1, 1).AddHours(5).ToUniversalTime().Dump(); new DateTime(2015, 6, 1, 1, 1, 1, DateTimeKind.Utc).AddHours(5).ToUniversalTime().Dump(); Here,...
c++,date,datetime,time,converter
There are 86400 seconds in a day, and 25569 days between these epochs. So the answer is: double DelphiDateTime = (UnixTime / 86400.0) + 25569; You really do need to store the Unix time in an integer variable though. ...
It won't allow me to make the default value the current datetime if the field type is "datetime". I can only do that with "timestamp". MySQL will allow you to specify a field of DATETIME with a default value of NOW(). This will get translated by MySQL to CURRENT_TIMESTAMP....
python,datetime,pandas,dataframes
You could use mask = df1['recvd_dttm'] <= datetime.datetime.now() df1 = df1.loc[mask] to select only those rows for which recvd_dttm is less than current datetime....
python,datetime,pandas,format,dataframes
import datetime as dt # convert strings to datetimes df['recvd_dttm'] = pd.to_datetime(df['recvd_dttm']) # get first and last datetime for final week of data range_max = df['recvd_dttm'].max() range_min = range_max - dt.timedelta(days=7) # take slice with final week of data sliced_df = df[(df['recvd_dttm'] >= range_min) & (df['recvd_dttm'] <= range_max)] ...
java,datetime,localization,java-8,java-time
The answer to the problem is the DateTimeFormatterBuilder class and the appendText(TemporalField, Map) method. It allows any text to be associated with a value when formatting or parsing, which solves the problem effectively and elegantly: Map<Long, String> monthNameMap = new HashMap<>(); map.put(1L, "Jan."); map.put(2L, "Feb."); map.put(3L, "Mar."); DateTimeFormatter fmt =...
That's the default format of CultureInfo.InvariantCulture, so you don't need to use ParseExact: DateTime date = DateTime.Parse(dateString, CultureInfo.InvariantCulture); string inGermanFormat = date.ToString("d.MM.yyyy HH:mm:ss", new CultureInfo("de-DE")); ...
datetime,time,timezone,timestamp,timestamp-with-timezone
For a single event, knowing the UTC instant on which it occurs is usually enough, so long as you have the right UTC instant (see later). For repeated events, you need to know the time zone in which it repeats... not just the UTC offset, but the actual time zone....
There is no need to worry about the format of the date when storing it. The database will simply store the date instance and you can use one of its functions to format it on retrieval. You could also use Java to format the date on retrieval using SimpleDateFormat...
You made a simple mistake with the property used to represent the intervals minutes, its i and not m. m is in fact the Months property. This is also how you would set the date using the European format $date = DateTime::createFromFormat('d/m/Y H:i:s', '21/06/2015 18:32:00'); $now = new DateTime(); $interval...
java,date,datetime,datetime-format
You format string has a couple of mistakes: Y means the week year, not the year, which is y D means the day of the year. You should have used d, which means the day of the month. h means a 12-hour notation time of day. Since you have 14...
Build up a list of possible formats and use DateTime.TryParseExact(). Then pass your desired output format to DateTime.ToString(). Dim date1 As String = "06/19/2015" Dim allowedFormats() As String = {"M/d/yy", "M/dd/yy", "MM/d/yy", "MM/dd/yy", "M/d/yyyy", "M/dd/yyyy", "MM/d/yyyy", "MM/dd/yyyy"} Dim dt As DateTime If DateTime.TryParseExact(date1, allowedFormats, Globalization.CultureInfo.InvariantCulture, Globalization.DateTimeStyles.None, dt) Then Dim date2...
javascript,date,datetime,angular-ui-bootstrap,milliseconds
getMilliseconds() returns the milliseconds part of the date, which is 0 is your case, since you constructed it from the date part (only) of a date. If I understand the requirement correctly, you're trying to get the date's representation as the number of milliseconds from the epoc. This is done...
In Global.asax.cs is an event handler protected void Session_End(object sender, EventArgs e) { } Which should get fired on session end....
You can use the SqlDateTime structure. DateTime now = DateTime.Now; SqlDateTime sqlNow = new SqlDateTime(now); bool equal = now == sqlNow.Value; // false So if you have a DateTime and want to know if it's equal to a DB-DateTime use: Assert.Equal(dbEndTime, new SqlDateTime(endTime).Value); // true SqlDateTime: Represents the date and...