Questions tagged [datetime-conversion]

Use this tag for questions related to the Datetime conversion, i.e. manipulating the Datetime in such a way, that a new, different in format, Datetime is produced.

is used in its general meaning, and is usually used for questions related on how to convert a Datetime object in another, new and with a different format, Datetime object, usually for making two different programming platforms communicate.

For example, your application may produce Datetimes of a specific format, but your Database to accept another Datetime format, different from the one your application is using. In that case, a conversion form the application's format to the Database's format is needed.

316 questions
2
votes
1 answer

R: How can I convert non-intuitive strings that describe hours, minutes, and seconds to a workable POSIXct format to perform standard arithmatic on?

I have a data set in R that has values in hours, minutes, and seconds format. However, some values only have hours and minutes, some only have minutes and seconds, some only have minutes, and some only have seconds. It's also not formatted very…
maudib528
  • 51
  • 1
  • 7
2
votes
3 answers

C# - Convert.ToDateTime() where Year is not specified in the Date

I would like to convert a list of dates that are represented as follows: June 6 September 18 November 2 February 29 The dates themselves do not specify the year so when I attempt to parse them using Convert.ToDateTime() the current year (2021) is…
webworm
  • 10,587
  • 33
  • 120
  • 217
2
votes
3 answers

How convert LocalDate to ChronoZonedDateTime?

In the code bellow, i'm getting an error in my "if" comparisson. The message says "isBefore(java.time.chrono.ChronoZonedDateTime) in ChronoZonedDateTime cannot be applied to (java.time.LocalDate)". How convert LocalDate to…
Liam Park
  • 414
  • 1
  • 9
  • 26
2
votes
2 answers

How do you represent MS-DTYP `DATETIME` in Java 8 Instant?

In the Microsoft Spec, DATETIME is represented as 2 32-bit integers: low and high Reference: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/cca27429-5689-4a16-b2b4-9325d93e4ba2 The FILETIME structure is a 64-bit value that…
Nicholas DiPiazza
  • 10,029
  • 11
  • 83
  • 152
2
votes
2 answers

Spark convert TimestampType to String of format yyyyMMddHHmm

In my dataframe I have a column of TimestampType format of '2019-03-16T16:54:42.968Z' I would like to convert this to a StringType column with a format of '201903161654' instead of a generic timestamp column. This is because I need to partition…
2
votes
2 answers

trouble understanding time conversions

I have some trouble understanding time conversions in python. I have two identical time_struct objects In [22]: local_dt Out[22]: datetime.datetime(2000, 1, 1, 0, 0, tzinfo=) In [23]:…
LarsVegas
  • 6,522
  • 10
  • 43
  • 67
2
votes
4 answers

Extract the hour part from the time and return it as an integer with pandas

I need to extract the hour part from a time column that represents time in the format of:"00:00:00" (hour:minutes:seconds), and return it as an integer with PANDAS. For example: if my time value is 00:12:06 I need to get the hour as an integer i.e.,…
Azi_bel
  • 55
  • 1
  • 4
  • 10
2
votes
1 answer

How to convert time from hh:mm:ss.mmm to seconds and milliseconds mysql

I would like to convert all values in a column from "hh:mm:ss.mmm" to "ss.mmm". I have tried TIME_FORMAT(Duration, 's%.f%) but this shows the seconds and milliseconds and doesn't keep calculate the correct seconds when values are over 1…
Isabel
  • 37
  • 6
2
votes
5 answers

Java String to Date object of the format “MM/dd/yyyy HH:mm:ss a”

I need to convert a String containing a date into a date object. The String will be in the format "yyyy-mm-dd HH:mm:ss" and I want the "MM/dd/yyyy HH:mm:ss a " format as result. String dateString = "2018-03-20 09:31:31"; DateTimeFormatter formatter…
Ban
  • 339
  • 1
  • 5
  • 16
2
votes
2 answers

Convert London Time & Date To GMT +6 Time & Date

I have collect the London time from Google . I want to get GMT+6 time and Date. I tried many ways but i can't reach to my destination . Can anyone please help me to solve this. I have converted all string to int . Here is My Code : CurrentDate…
user9271543
2
votes
4 answers

Convert string in T-SQL (YYYMMDD)

I have a column exit_date with varchar like 5/21/2008 0:00 and I need to update it to a string like YYYYMMDD, any way to do that? 5/21/2008 0:00 ==> 20080521 1/1/2007 0:00 ==> 20070101 How to do something like select convert('5/21/2008…
Daniel Wu
  • 5,853
  • 12
  • 42
  • 93
2
votes
3 answers

TSQL Date conversion

I have a SQL table with datetime2 objects, and they are stored in UTC TIME for example UTC_TIME = 2017-10-20T13:16:14.6950000 I have successfully converted this timestamp to local time using SELECT UTC_TIME AT TIME ZONE 'W. Europe Standard Time' AS…
Kermit754
  • 343
  • 5
  • 14
2
votes
3 answers

yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z' format

I am trying to convert GMT to IST. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS"); Date c= sdf.parse("2017-03-31T10:38:14.4723017Z"); Date date = new Date(); DateFormat istFormat = new SimpleDateFormat(); …
kushi
  • 67
  • 1
  • 2
  • 9
2
votes
3 answers

PHP intl can convert a Gregorian date to other calendar type

PHP intl can convert a Gregorian date to other calendar type. For example Gregorian to Hijri, 2017/04/11 to 1396/01/22 Or we must use external library to convert dates?
msoa
  • 1,339
  • 3
  • 14
  • 33
2
votes
2 answers

Converting a time decimal/fraction representing days to its actual time in R?

I have a column in R on my dataset with values that have been converted into what I believe is a time decimal fraction based on days. I have been using this site as a reference:…
KieranLowe
  • 81
  • 1
  • 10