datetime

Javascript ASP.net date format without timezone info - timezone offsets

I have a client side JavaScript that generates a date in JavaScript( new Date(2007,5,1)). I need this date passed through to a hidden field that the code behind can access. My issue is that when the hidden field is converted into a DotNet datetime, the time is incorrect. This is because the JavaScript is including timezone info from th...

LaTeX - Insert the current year (like \today)?

Using the LaTeX command \today, I can insert the current date. Is there any way to insert the current year with a simple command? All I want is the simple 4 digit year that shows up in \today ...

Convert and format datetime to String in C#

I have birth dates stored as datetime in SQL Server 2008 like so: 2010-04-25 00:00:00.000 What is the best way, using C#, to convert and format this into a string with a YYYYMMDD format? In the end, all I need is a string like: 20100425 Any help is greatly appreciated! ...

Prevent timezone conversion on deserialization of DateTime value

I have a class that I serialize/deserialize using XmlSerializer. This class contains a DateTime field. When serialized, the DateTime field is represented by a string that includes the offset from GMT, e.g 2010-05-05T09:13:45-05:00. When deserialized, these times are converted to the local time of the machine performing the deserializa...

How to include milliseconds in a DateTime user setting?

I have the following user setting defined in app.config: <userSettings> <MyProject.Properties.Settings> <setting name="LastProcessedDate" serializeAs="String"> <value>07/06/2010 13:05:10</value> </setting> </MyProject.Properties.Settings> </userSettings> Is there a way to specify that this setting s...

TSQL need to return last day of month only, how do I drop year, month & time?

I am writing a User defined function in TSQL trying to get the last day of the month regardless of the date input. I am struggling with this as I am a newbie. Any help will be very much appreciated. Here is my function: Alter Function dbo.FN_Get_Last_Day_in_Month2 (@FN_InputDt Datetime) Returns smalldatetime as Begin Declare @Resu...

Date calculations in Python

I am relatively new to Python, and I am experimenting with writing the following date calc functions find the date that is/was Monday for a specified datetime find the first non-weekend day of the month in a specified datetime find the first non-weekend day of the year in a specified datetime find the Nth [day of week] for a month in a...

.NET LINQ foreach DATETIME cannot convert String to DateTime exception

I have SQL data table that containes a DATE or DATETIME field a LINQ statement show here just to get the basic idea var testLinq = from t in DBDataContext.Certificates select t; foreach (var t in testLinq) { .... } Left out the code in {..} for briefness. BUT whenever 'foreach' tries to use t I get this exception ...

Date Range Overlap with Nullable Dates

I'm looking for an extended answer to the question asked here: http://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap where any of the dates in either date range can be null. I've come up with the following solution, but I'm not sure if it can be simplified further. (StartA == NULL || StartA <= EndB) && (E...

Fixing VB6 Date Bug?

It seems that VB6 can't correctly compare dates in some situations. Are there any solutions to this? Private Sub CheckDate() date1 = #7/6/2010 2:00:00 PM# Debug.Print "Date 1: " + CStr(date1) date2 = DateAdd("h", -8, #7/6/2010 10:00:00 PM#) Debug.Print "Date 2: " + CStr(date2) Debug.Print "Equal? " + CStr(date1 =...

What's the epoch of DateTime(Int64)?

What's the epoch of DateTime(Int64)? ...

Leading zero when subtracting one time from another javascript

function setValue() { var startTime = document.getElementById('ToilA'); var endTime = document.getElementById('EndHours'); startTime = startTime.value.split(":"); var startHour = parseInt(startTime[0], 10); var startMinutes = parseInt(startTime[1], 10); endTime = endTime.value.split(":"); var endHour = parseInt(endTime[0], 10); va...

How can I set TimeZone for my ASP.NET (MVC) Application

My Application hosted at server in time zone which differs from mine. All date in database is not correct for my time zone. How can I set my time zone for Application or how I can convert date to my time zone on output ...

Storing and retrieving a date in PHP?

This is what I need to do: I need to perform a PHP operation, then retrieve how long ago the last time the operation was performed was. I have it all figured out, except one thing - how do I find the difference between two date/times? Or, is there an easier way to do this? (This is based in Wordpress, so I'm using wp_options to store the...

Future Local time of a place using longitude latitude and datetime

i am developing a travel application. for that I need to calculate the future local datetime of a location using Datetime (a future date),longitude and latitude. (for Eg: i want to calculate the local datetime of a location on August-10- 2010 11.23 AM . Due to the day light saving time the datetime offset may change so i need to convert...

Get Date details (day, month, year) in GWT

I need to get the day, month, year details from a Date value but getYear() is deprecated, gives year on 2 digits, and has problems with Y2K (2008 gives 108). The java doc recommends using java.util.calendar but it is not supported in GWT. I want to avoid sending all the info back and forth between the server and client just to deal with...

Getting wrong value of Time in Google Calendar

Hi, I am migrating Calendars to Google Apps using Google API Version 2 for .NET as below: EventEntry entry = new EventEntry(); entry.Title.Text = "Test Calendar"; When eventTime = new When(StartDate, EndDate, false); I am setting : : StartDate = {6/18/2010 3:00:00 PM} EndDate = {6/18/2010 4:00:00 PM} But after migration...

Pretty-printing a datetime as a day of the week plus time in jQuery/JavaScript

Hi guys, I'm looking for a (ideally jQuery plugin) Javascript library that will let me provide datetimes formatted in whatever standard format (ISO 8601 seems to be the most commonly used among libraries that do something similar, like timeago and Prettydate), and have them transformed into strings like: Wednesday, 5:00pm Tomorrow, 9:...

Editing a Date field in Appengine Data Store Viewer

Does anyone know how edit a field with type 'Date' in the appengine data store viewer in production? It seems like it maps to an int field and I tried putting in the number of milliseconds since epoch but that didnt work. ...

how do I insert a string datetime into mysql using c++

I have a datetime field in the following format: string date = "Jun 23 19:47:15 +0000 2010"; how do I insert it ito datetime field in mysql table? I am assuming I have to convert the date into unix timestamp before I insert it into the table. ...