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
6
votes
3 answers

PersianCalendar can't convert year/month/31(day) to standard date

I am trying to convert persianDate to standarddate . public DateTime ConvertPersianToEnglish(string persianDate) { string[] formats = { "yyyy/MM/dd", "yyyy/M/d", "yyyy/MM/d", "yyyy/M/dd" }; DateTime d1 = DateTime.ParseExact(persianDate,…
Ehsan Akbar
  • 6,977
  • 19
  • 96
  • 180
5
votes
2 answers

Converting Seconds and Duration to SRT (subtitle) time format (PHP)

I have an input like like this: start: 10 | duration: 1 | text: Subtitle Text 1 start: 15 | duration: 2 | text: Subtitle Text 2 start: 20 | duration: 3 | text: Subtitle Text 3 It's a subtitle instruction set, that says following: At 10 second of…
jjj
  • 2,594
  • 7
  • 36
  • 57
5
votes
4 answers

Converting DateTimes that are near DayLight Savings time?

I'm working on software that runs reports for GPS devices that are running 24/7/365. Part of the report output requires that we convert our stored database times (kept in Central Standard Time) to user timers (any requested time zone). Twice a year…
Corey Ogburn
  • 24,072
  • 31
  • 113
  • 188
5
votes
2 answers

How do I convert milliseconds to a TDateTime?

I'm doing a long loop downloading thousands of files. I would like to display an estimated time remaining, since it could take hours. However, with what I've written, I get an average number of milliseconds. How do I convert this average download…
Jerry Dodge
  • 26,858
  • 31
  • 155
  • 327
4
votes
3 answers

DB2 timestampdiff function returning unexpected results

I'm using the following syntax TIMESTAMPDIFF(2, CHAR(CREATED - TIMESTAMP('1970-01-01 00:00:00')) where CREATED is of type TIMESTAMP and the database is DB2. The intension is to get the timestamp converted to millis from epoch. If there is a better…
Manoj
  • 5,542
  • 9
  • 54
  • 80
4
votes
3 answers

Convert utc to local datetime

i've got an globalization setting in the web.config like this: and on an average aspx page i output sth. like: var a = DateTime.UtcNow.ToLocalTime().ToString(); var b =…
David
  • 2,551
  • 3
  • 34
  • 62
4
votes
1 answer

Prestosql converting UTC timestamp to local?

How can I convert a timestamp field that includes day and time to local time in Prestosql? The fields look like Region ID | Start Time utc | End Time utc abc 2019-04-26 20:00:00.000 2019-04-26 23:00:00.000 cdx …
Chris90
  • 1,868
  • 5
  • 20
  • 42
4
votes
1 answer

utc string to unix time conversion python

I have a list of UTC time stamps stored as string format as follows: '20170124T1815' Is there a function in python to convert these strings to unix time? I have tried: dt =…
coja7723
  • 43
  • 1
  • 5
4
votes
3 answers

Convert milliseconds into hours and plot

I'm trying to convert an array of milliseconds and its respective data. However I want to do so in hours and minutes. Millis = [60000 120000 180000 240000....] Power = [ 12 14 12 13 14 ...] I've set it up so the data records every minute, hence…
4
votes
2 answers

PHP - Can't set correct DateTimeZone to DateTime

Background I have a list of events that are set to a certain (UK) time. I want users to see the time of the event in their local time. For example: if an event starts at 20:30 UK time a user from the Netherlands should see the start time as…
Bono
  • 4,757
  • 6
  • 48
  • 77
4
votes
2 answers

Converting hour, minutes columns in dataframe to time format

I have a dataframe containing 3 columns including minutes and hours. I want to convert these columns (namely minutes and column) to time format. Given the data in drame: Score Hour Min 10 10 56 23 17 01 I would like to get: Score…
jan5
  • 1,129
  • 3
  • 17
  • 28
3
votes
1 answer

C# Datetime cannot convert yyyy-MM-dd'T'HH:mm:ss.SSSZ to Datetime

For a project I am creating an ASP.net Core Web API. I created a POST endpoint for request from a Webhook (Java API) My C# Class: public class Data { [JsonPropertyName("state")] public string? state { get; set; } …
3
votes
3 answers

I need a conversion function, from integer to date-time

Is there a conversion to go from an integer (ex: 54600) to date-time format? I am seeing the integers in a flowsheet in healthcare, used to record a time CONVERT(varchar, DATEADD(ms, b22.meas_value * 1000, 0), 114) AS 'START TIME' : Is the code…
3
votes
0 answers

Is there any .c source file available to convert TAI time to UTC?

I am trying to implement BLE mesh Time model. The time data received from the mesh is in TAI format and i need to use local RTC to keep track of this time. For this, I have to convert the TAI time from mesh to UTC locally so that my node can keep…
3
votes
3 answers

Javascript - Convert a datetime, knowing its time zone, to UTC

I must convert a date time, given its time zone, year, month, day, hours and minutes to an ISO string. For example, given the following parameters: { timeZone: 'Europe/Paris', year: 2020, month: 11, day: 18, hours: 14, minutes: 44, } I want…
1 2
3
21 22