Search Results

Search found 12421 results on 497 pages for 'date arithmetic'.

Page 32/497 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Storing date/times as UTC in database

    - by James
    I am storing date/times in the database as UTC and computing them inside my application back to local time based on the specific timezone. Say for example I have the following date/time: 01/04/2010 00:00 Say it is for a country e.g. UK which observes DST (Daylight Savings Time) and at this particular time we are in daylight savings. When I convert this date to UTC and store it in the database it is actually stored as: 31/03/2010 23:00 As the date would be adjusted -1 hours for DST. This works fine when your observing DST at time of submission. However, what happens when the clock is adjusted back? When I pull that date from the database and convert it to local time that particular datetime would be seen as 31/03/2009 23:00 when in reality it was processed as 01/04/2010 00:00. Correct me if I am wrong but isn't this a bit of a flaw when storing times as UTC? Example of Timezone conversion Basically what I am doing is storing the date/times of when information is being submitted to my system in order to allow users to do a range report. Here is how I am storing the date/times: public DateTime LocalDateTime(string timeZoneId) { var tzi = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId); return TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi).ToLocalTime(); } Storing as UTC: var localDateTime = LocalDateTime("AUS Eastern Standard Time"); WriteToDB(localDateTime.ToUniversalTime());

    Read the article

  • How to format JSON Date?

    - by Mark Struzinski
    I'm taking my first crack at AJAX with jQuery. I'm getting my data onto my page, but I'm having some trouble with the JSON that is returned for Date data types. Basically, I'm getting a string back that looks like this: /Date(1224043200000)/ From a total newbie at JSON - How do I format this to a short date format? Should this be handled somewhere in the jQuery code? I've tried the jQuery.UI.datepicker plugin using $.datepicker.formatDate() wiuth no success. FYI: Here's the solution I came up with using a combination of the answers here: function getMismatch(id) { $.getJSON("Main.aspx?Callback=GetMismatch", { MismatchId: id }, function(result) { $("#AuthMerchId").text(result.AuthorizationMerchantId); $("#SttlMerchId").text(result.SettlementMerchantId); $("#CreateDate").text(formatJSONDate(Date(result.AppendDts))); $("#ExpireDate").text(formatJSONDate(Date(result.ExpiresDts))); $("#LastUpdate").text(formatJSONDate(Date(result.LastUpdateDts))); $("#LastUpdatedBy").text(result.LastUpdateNt); $("#ProcessIn").text(result.ProcessIn); } ); return false; } function formatJSONDate(jsonDate){ var newDate = dateFormat(jsonDate, "mm/dd/yyyy"); return newDate; } This solution got my object from the callback method and displayed the dates on the page properly using the date format library.

    Read the article

  • A Small Utility to Delete Files recursively by Date

    - by Rick Strahl
    It's funny, but for me the following seems to be a recurring theme: Every few months or years I end up with a host of files on my server that need pruning selectively and often under program control. Today I realized that my SQL Server logs on my server were really piling up and nearly ran my backup drive out of drive space. So occasionally I need to check on that server drive and clean out files. Now with a bit of work this can be done with PowerShell or even a complicated DOS batch file, but heck, to me it's always easier to just create a small Console application that handles this sort of thing with a full command line parser and a few extra options, plus in the end I end up with code that I can actually modify and add features to as is invariably the case. No more searching for a script each time :-) So for my typical copy needs the requirements are: Need to recursively delete files Need to be able to specify a filespec (ie. *.bak) Be able to specify a cut off date before which to delete files And it'd be nice to have an option to send files to the Recycle bin just in case for operator error :-)(and yes that came in handy as I blew away my entire database backup folder by accident - oops!) The end result is a small Console file copy utility that I popped up on Github: https://github.com/RickStrahl/DeleteFiles The source code is up there along with the binary file you can just run. Creating DeleteFiles It's pretty easy to create a simple utility like DeleteFiles of course, so I'm not going to spend any talking about how it works. You can check it out in the repository or download and compile it. The nice thing about using a full programming language like C over something like PowerShell or batch file is that you can make short work of the recursive tree walking that's required to make this work. There's very little code, but there's also a very small, self-contained command line parser in there that might be useful that can be plugged into any project - I've been using it quite a bit for just about any Console application I've been building. If you're like me and don't have the patience or the persistence (that funky syntax requires some 'sticking with it' that I simply can't get over) to get into Powershell coding, having an executable file that I can just copy around or keep in my Utility directory is the only way I'll ever get to reuse this functionality without going on a wild search each time :-) Anyway, hope some of you might find this useful. © Rick Strahl, West Wind Technologies, 2005-2012Posted in Windows  CSharp   Tweet !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();

    Read the article

  • How can I set view preferences to sorted by reverse date modified?

    - by Statwonk
    I'd like to permanently set Nautilus's view preferences to show files sorted in reverse by date modified (newest first). Similar questions have been asked before: How can I sort files in Nautilus by modified date? Can I view my files sorted by date? However, they don't address making the preference permanent. Nautilus's preferences allow you to set sort by date modified (oldest first), but not reverse date modified (newest first). Does anyone have suggestions on setting sorted by reverse date modified as default?

    Read the article

  • iPhone SDK NSString To NSDate

    - by disp
    I got a string from parsing a XML file which looks like this: Fri, 09 Apr 2010 00:00:45 +0200 and the corresponding pattern should be this "EEE, dd MMM yyyy HH:mm:ss ZZ", but I get (null). This is my code: NSString *dateString = @"Fri, 09 Apr 2010 00:00:45 +0200"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss ZZ"]; NSDate *date = [dateFormatter dateFromString:dateString]; NSLog(@"date:%@",date); // result date:(null) Edit: This works for me now, I had to switch to en-US locale: NSLocale* usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en-US"]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setLocale:usLocale]; [dateFormatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss ZZ"]; NSDate *date = [dateFormatter dateFromString:dateString];

    Read the article

  • Library to work with date expressions in C#?

    - by ObligatoryMoniker
    What library can I use to calculate dates based on date expressions? A date expression would be something like: "+3D" (plus three days) "-1W" (minus one week) "-2Y+2D+1M" (minus 2 years, plus one day, plus one month) Example: DateTime EstimatedArrivalDate = CalcDate("+3D", DateTime.Now); Where estimated arrival date would equal the current date plus 3 days. I have heard about JodaTime and NodaTime but I have not seen anything in them yet that does this. What should I be using to get this functionality in C#?

    Read the article

  • Date Picker Today Option In WPF

    - by Asim Sajjad
    Is there any property , option available in the date picker control so that if user want to select today from any date from current date ? e.g if user is view current month of last year then he has the option to select current date ?

    Read the article

  • LibreOffice Calc/Writer: How to get the dates for specifc weekdays per month?

    - by Phin
    I'm stuck with a problem in LibreOffice Calc or Writer: I try to get a table of dates for every monday, wednesday and friday per month, something that I can load every new month wich sets the dates automatically so I just have to print the page on paper. :) In Writer the fieldcommand for date can't obviosly do the job (it only can be set to a fix date, the todays date or +offset as far as I can see). In Calc I tried it with the autofill but that obviosly works for the first 3 days only. I might add that I'm lost with Excel/calc formulars... Any help?

    Read the article

  • Excel Date to String conversion

    - by Chaitanya MSV
    Hi I have a Date value like 01/01/2010 14:30:00 in a cell in Excel sheet. I want to convert that Date to Text and also want the Text to look exactly like Date. So a Date value of 01/01/2010 14:30:00 should look like 01/01/2010 14:30:00 but internally it should be Text. How can I do that in Excel? Thank you! Chaitanya

    Read the article

  • C# - Regular Expression validating Date and Hour

    - by nettguy
    I receive Date and time from CSV file The received Date format is YYYMMDD (string) (there is no ":" ,"-","/" to separate Year month and date). The received time format is HH:MM (24 Hour clock). I have to validate both so that (example) (i) 000011990 could be invalidated for date (ii) 77:90 could be invalidated for time. The question is , Regular expression is the right candidate for do so (or) is there any other way to achieve it?

    Read the article

  • Optimizing MySQL update query

    - by Jernej Jerin
    This is currently my MySQL UPDATE query, which is called from program written in Java: String query = "UPDATE maxday SET DatePressureREL = (SELECT Date FROM ws3600 WHERE PressureREL = (SELECT MAX" + "(PressureREL) FROM ws3600 WHERE Date >= '" + Date + "') AND Date >= '" + Date + "' ORDER BY Date DESC LIMIT 1), " + "PressureREL = (SELECT PressureREL FROM ws3600 WHERE PressureREL = (SELECT MAX(PressureREL) FROM ws3600 " + "WHERE Date >= '" + Date + "') AND Date >= '" + Date + "' ORDER BY Date DESC LIMIT 1), ..."; try { s.execute(query); } catch (SQLException e) { System.out.println("SQL error"); } catch(Exception e) { e.printStackTrace(); } Let me explain first, what does it do. I have two tables, first is ws3600, which holds columns (Date, PressureREL, TemperatureOUT, Dewpoint, ...). Then I have second table, called maxday, which holds columns like DatePressureREL, PressureREL, DateTemperatureOUT, TemperatureOUT,... Now as you can see from an example, I update each column, the question is, is there a faster way? I am asking this, because I am calling MAX twice, first to find the Date for that value and secondly to find the actual value. Now I know that I could write like that: SELECT Date, PressureREL FROM ws3600 WHERE PressureREL = (SELECT MAX(PressureREL) FROM ws3600 WHERE Date >= '" + Date + "') AND Date >= '" + Date + "' ORDER BY Date DESC LIMIT 1 That way I get the Date of the max and the max value at the same time and then update with those values the data in maxday table. But the problem of this solution is, that I have to execute many queries, which as I understand takes alot more time compared to executing one long mysql query because of overhead in sending each query to the server. If there is no better way, which solution beetwen this two should I choose. The first, which only takes one query but is very unoptimized or the second which is beter in terms of optimization, but needs alot more queries which probably means that the preformance gain is lost because of overhead in sending each query to the server?

    Read the article

  • Simple HTTP Framework and time issue

    - by Deniz Acay
    I'm using Simple Framework for my recent project, and there is a problem with the date headers generated by the system. I can get my local time from Date class correctly, but setDate method of Simple's Response class sets date in milliseconds and when i do that by calling System.currentTimeInMillis, dates in response headers are incorrect. is there any way to solve this problem with Simple Framework? If not, what can i do except calling set method with a date string? Thanks in advance... EDIT: Date in the headers are in wrong timezone. And i also tried Calendar.getInstance().getTimeInMilis() method.

    Read the article

  • Binary to Date (C#) 64 Bit Format

    - by Veskechky
    We have a binary file from which we have identified the following dates (as Int64). We now the following facts about the Date/Time format; The 64 bit Date has a resolution to the microsecond The 64 bit Date has a range of 4095 years The Int64 9053167636875050944 (0x7DA34FFFFFFFFFC0) = 9th March 2010 The Int64 9053176432968073152 (0x7DA357FFFFFFFFC0) = 10th March 2010 The Int64 9053185229061095360 (0x7DA35FFFFFFFFFC0) = 11th March 2010 The Int64 9053194025154117568 (0x7DA367FFFFFFFFC0) = 12th March 2010 Any help on figuring out a way to convert this to a valid C# Date/Time is appreciated.

    Read the article

  • C# Application self-destroy at specific date

    - by DanSogaard
    Is there anyway I can use to destroy my deployed application at specific date?. How can I order the application to destroy itself at specific date after installation?. Say I deployed my C# application at PC1 today. After a specific date the application is deleted and removed off PC1 automatically (Installation folder removed). How can I do that?. If this is not possible, at least how can I prevent the user from using it anymore after specific date?.

    Read the article

  • Android Time&Date Picker

    - by vycon
    Hello, Is there any android widget that enable to pick the date and the time at the same time ? I already use the basic date picker and date picker: http://developer.android.com/guide/tutorials/views/hello-timepicker.html http://developer.android.com/guide/tutorials/views/hello-datepicker.html but they are not that sexy and user friendly (I found). Do you know if a widget including both date and time exists? Thanks a lot,WW.

    Read the article

  • How to convert DateTime string into a Format string

    - by AMissico
    With .NET, I have "Thursday, April 10, 2008 1:30:00 PM" and I want "dddd, dd MMMM, yyyy h:m:s t", "6:09:01 PM" and want ""hh:mm:ss tt", "Fri 29 Aug" and want "ddd d MMM", and so on. It seems I should be able to use DateTimeFormatInfo in some way. I figured I can format the date with each pattern returned by GetAllDateTimePatterns, and when the original date string and the formated date string match then I have the format. Yet, I want to generate custom formats, not the standard formats. I want the format string. I do not want the date. I have both the DateTime value and the formatted string value for the date. I need <formatString> as in ToString(<formatString>).

    Read the article

  • Date format error in vb.net ?

    - by ahmed
    I get this error when I run the application Incorrect syntax near 12, on debugging I found that this error is caused due to the # along with the date. Dim backdate as datetime backdate = DateTime.Now.AddDays(-1) on binding the data to the grid to filter the backdate records this error is caused Incorrect syntax near 12. myqry = " select SRNO,SUBJECT,ID where datesend =" backdate Now i am trying to extract only the date or shall I divide the date into day , month and year with DATEPART and take into a variable or convert the date or what should i do , Please help ???

    Read the article

  • How to choose my own filename format for subscribed podcast files?

    - by meomaxy
    I subscribe to several podcasts where the filenames of the downloaded mp3 files have no particular pattern to them. When I copy the directory of accumulated mp3 files into my mp3 player, the files play in alphabetical order. What I really want is to play the files chronologically by release date. I currently use iTunes on Windows XP to download the files. What I do now is manually rename the files, adding the date in YYYYMMDD format to the start of each filename so that an alphabetical listing of files will correspond to their chronological order when I listen to them later in PocketTunes on my Palm Centro. Is there some way to get the release date into the filename automatically? If so, I could automate or possibly skip the file renaming step. I would switch from iTunes to something else if that would solve my problem. The file creation time on my local disk isn't a reliable indicator because sometimes I download a few days worth of content at one time, and the files don't necessarily get downloaded in chronological order.

    Read the article

  • Selecting rows without a value for Date/Time columns

    - by Ross
    I'm running this query: SELECT TOP 1 [DVD Copy].[Stock No] FROM [DVD Copy] WHERE [DVD Copy].[Catalogue No] =[Forms]![New Rental]![Catalogue No] And [Issue Date] = Null; Which works fine without the null check for Issue Date. I'm trying to select rows without a Date in the Issue Date column. Is Null the wrong kind of value to use for here?

    Read the article

  • Use boost date_time to parse and create HTTP-dates

    - by John Price
    I'm writing a kind of HTTP proxy, so I need to be able to do 3 things: Parse an HTTP-date given any of the 3 formats specified in RFC 2616, sec 3.3, Convert a file date-time to an HTTP-date string, and Output the date to a string. For reference, theses are examples of the date-times I need to parse. I will output only the first format: Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format I'm pretty sure Boost date_time can do all of this, but I'm having some trouble with number 1. Does anyone already have code to do this? Perhaps I'm not using google proficiently, but I can't find an example of how to do this with boost anywhere. Thanks for any help!

    Read the article

  • Date check for counting 30 days

    - by sijith
    Hi, I want to count the days passed with respect to a given date. I have a predefined date with me and i want to check the days passed, once the day pass 30 days with respect to the given time i want to get a message. example given date is25/03/2010 and when my system date reaches 25/04/2010 i have to get a message. How can i implement it. please give some help

    Read the article

  • date() function problem

    - by Syom
    i use date function to get day, month and year. $year = date(y); $month = date(m); $day = date(d); but my hosting is in another place where i am, so i need to add 11 hours. could you tell me how can i do that? thanks

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >