Questions tagged [datetime]

A DateTime object in many programming languages describes a date and a time of day. It can express either an instant in time or a position on a calendar, depending on the context in which it is used and the specific implementation. This tag can be used for all date and time related issues.

A DateTime object in many programming languages describes a date and a time of day. It can express either an instant in time or a position on a calendar, depending on the context in which it is used and the specific implementation.

  • In , os.date and os.time are provided as part of lua's standard library for working with date and time.

  • In the data types TIMESTAMP [WITHOUT TIME ZONE] and TIMESTAMP WITH TIME ZONE are collectively referred to as timestamps. (And the data types DATE, TIME, and TIMESTAMP are collectively referred to as datetime types.)

  • In , datetime is a type that represents a date and time of day. It carries no time zone context, so it is a position on a calendar, not a moment in time.

  • In , DATETIME values represent a date and time of day. They carry no time zone context, so they are positions on a calendar, not a moment in time. TIMESTAMP values represent a moment in time, and are based on UNIX time. When MySQL stores TIMESTAMPs, it converts them from the current connection's time zone setting to UTC. When displaying them it converts them back.

  • In , DateTime is a structure that is typically expressed as a date and time of day. It represents either an instant in time, or a position on a calendar. The precise meaning is dependent on the value of its Kind property.

  • In , Instant is a class that represents an instant in time. Before Java 8 was a popular library, DateTime is a class which represents an instant in time, with reference to a particular time zone.

  • In , datetime is an object which represents a date and time of day. The precise meaning is dependent on the value of its tzinfo property. It is also the name of the module that provides date, time, datetime, and related objects.

  • In the DateTime class is a representation of a instant in time, with reference to a particular time zone.

  • In , the time and date manipulation library datetime-fortran can be used.

  • In , a Date instance represents a single moment in time. Date objects are based on a time value that is the number of milliseconds since 1 January, 1970 UTC. That is, they are UNIX time values in milliseconds.

  • In , the classes "POSIXlt" and "POSIXct" represent calendar dates and times.Subtraction of two date-time objects is equivalent to using difftime. Class "POSIXct" represents the (signed) number of seconds since the beginning of 1970 (in the UTC time zone) as a numeric vector. Class "POSIXlt" is a named list of vectors representing sec, min, hour et al

  • In , Microsoft Excel for Windows uses the 1900 date system, by default. Which means the first date is January 1, 1900. a Date and Time function can be used to manipulate the year/date and time/hour/minutes values. The date/time in Excel is stored as a number. Where the decimal part range from 0.0 to 0.99988426 represent 0:00:00 (12:00:00 AM) to 23:59:59 (11:59:59 P.M.), and the integer part range from 0 to 9999 represent days. But Excel's date representation is slightly off in the first two months of calendar year 1900.


Helpful articles

70365 questions
28
votes
2 answers

How can I get hours from a Python datetime?

I have a Python datetime, d, and I want to get the number of hours since midnight as a floating point number. The best I've come up with is: h = ((((d.hour * 60) + d.minute) * 60) + d.second) / (60.0 * 60) Which gives 4.5 for 4:30am, 18.75 for…
Chris Nelson
  • 3,519
  • 7
  • 40
  • 51
28
votes
10 answers

Convert AM/PM time to 24 hours format?

I need to convert 12 hours format time (am/pm) to 24 hours format time, e.g. 01:00 PM to 13:00 using C#. How can I convert it?
nmathur
  • 423
  • 1
  • 4
  • 6
28
votes
3 answers

ASP.NET MVC3 - DateTime format

I'm using ASP.NET MVC 3. My ViewModel looks like this: public class Foo { [DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)] public DateTime StartDate { get; set; } ... } In…
šljaker
  • 7,294
  • 14
  • 46
  • 80
28
votes
6 answers

Right way to format date with strings like today, yesterday, tomorrow etc

I have a date textview. And my textview holds a date string like 2011.09.17. Well I still do want to have that but I also want to add some more user friendly info for some specific dates like today or yesterday. For example if today is 2011.09.17 I…
Lukap
  • 31,523
  • 64
  • 157
  • 244
28
votes
1 answer

How to import DateTimeFormatOptions in

I want to store a DateTimeFormatOptions for date.toLocaleString() to use in multiple places in my app. I defined it like: export const timeFormat = { month: 'numeric', day: '2-digit', hour: '2-digit', minute: '2-digit', hour12: false, timeZoneName:…
yesennes
  • 1,147
  • 1
  • 10
  • 19
28
votes
10 answers

How to convert number of week into date?

Given a year and calendar week, how can I get the tuesday of that week as a date?
Cephalopod
  • 14,632
  • 7
  • 51
  • 70
28
votes
2 answers

How to pass datetime from c# to sql correctly?

I have a table and the date-times in it are in the format: 2011-07-01 15:17:33.357 I am taking a c# DateTime when I do a .ToString() on the object I am getting a DateTime in the format: 04/07/2011 06:06:17 I'm wondering how I correctly pass the…
Exitos
  • 29,230
  • 38
  • 123
  • 178
28
votes
3 answers

Timestamp object has no attribute dt

I am trying to convert a new column in a dataframe through a function based on the values in the date column, but get an error indicating "Timestamp object has no attribute dt." However, if I run this outside of a function, the dt attribute works…
Shawn Schreier
  • 780
  • 2
  • 10
  • 20
28
votes
5 answers

DateTime.Parse American Date Format C#

Probably a simple question - I'm reading in data from a number of files. My problem is, that when I'm reading in the date from an american file, I parse it like so: DateSold = DateTime.Parse(t.Date) This parses the string t.Date into a date…
109221793
  • 16,477
  • 38
  • 108
  • 160
28
votes
3 answers

How can I convert my datetime column in pandas all to the same timezone

I have a dataframe with a DataTime column (with Timezone in different formats). It appears like timezone is UTC but I want to convert the column to pd.to_datetime and that is failing. That is problem #1. Since that fails I cannot do any datetime…
py_noob
  • 433
  • 2
  • 8
  • 17
28
votes
8 answers

How can I get the utc offset in Rails?

I need the utc offset from the timezone specified.
Lucas Renan
  • 3,787
  • 3
  • 28
  • 35
28
votes
4 answers

mysql adding hours to datetime

In MYSQL DB I need to check if a "datetime" field is more than 24hours (or whatever) ago in which case delete the row. How to add hours to datetime in mysql? thanks Luca
luca
  • 36,606
  • 27
  • 86
  • 125
28
votes
4 answers

How To Set DateTime.Kind for all DateTime Properties on an Object using Reflection

In my application I retrieve domain objects via a web service. In the web service data, I know all the date values are UTC, but the web service does not format its xs:dateTime values as UTC dates. (In other words the letter Z is not appended to the…
RunnerRick
  • 949
  • 2
  • 12
  • 21
28
votes
5 answers

What's the best way to store datetimes (timestamps) in CouchDB?

I'm thinking that UTC time strings like 2011-01-26 21:41:09 +0000 might be okay since they sort correctly if they are used in a view key, but storing the time zone (e.g. 2011-01-26 16:41:09 -0500) would make the document more readable. Converting…
dan
  • 43,914
  • 47
  • 153
  • 254
28
votes
3 answers

pyspark's "between" function: range search on timestamps is not inclusive

pyspark's 'between' function is not inclusive for timestamp input. For example, if we want all rows between two dates, say, '2017-04-13' and '2017-04-14', then it performs an "exclusive" search when the dates are passed as strings. i.e., it omits…
Vinay Kolar
  • 913
  • 1
  • 7
  • 13