How to change utc Date in a normal Date
-
1448281492 is an Utc-Date (as a decimal?) now i will get these date as a date of my time zone. Can you may help me?
-
1448281492 is an Utc-Date (as a decimal?) now i will get these date as a date of my time zone. Can you may help me?
Member 11916735 wrote:
1448281492 is an Utc-Date (as a decimal?)
It's probably the number of ticks. See this DateTime-constructor: DateTime Constructor (Int64, DateTimeKind) (System)[^]
Member 11916735 wrote:
now i will get these date as a date of my time zone
You can either use DateTime.ToLocalTime()[^] or TimeZoneInfo.ConvertTimeFromUtc(..)[^]. For further reading on the topic, see Converting Times Between Time Zones[^].
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
-
1448281492 is an Utc-Date (as a decimal?) now i will get these date as a date of my time zone. Can you may help me?
-
1448281492 is an Utc-Date (as a decimal?) now i will get these date as a date of my time zone. Can you may help me?
-
1448281492 is an Utc-Date (as a decimal?) now i will get these date as a date of my time zone. Can you may help me?
Where is this data coming from? It might actually be a C++ time_t date (seconds since midnight 1970). Best, John
-- Log Wizard - a Log Viewer that is easy and fun to use!
-
1448281492 is an Utc-Date (as a decimal?) now i will get these date as a date of my time zone. Can you may help me?
THANKS! I get it! item.CreationDate is a value from a database: it's the utcDate so now I have this code:
string einstellDatumTemp = item.creationDate.ToString();
int unixTimestamp = int.Parse(einstellDatumTemp);
DateTime unixYear0 = new DateTime(1970, 1, 1);
long unixTimeStampInTicks = unixTimestamp * TimeSpan.TicksPerSecond;
DateTime dtUnix = new DateTime(unixYear0.Ticks + unixTimeStampInTicks); -
THANKS! I get it! item.CreationDate is a value from a database: it's the utcDate so now I have this code:
string einstellDatumTemp = item.creationDate.ToString();
int unixTimestamp = int.Parse(einstellDatumTemp);
DateTime unixYear0 = new DateTime(1970, 1, 1);
long unixTimeStampInTicks = unixTimestamp * TimeSpan.TicksPerSecond;
DateTime dtUnix = new DateTime(unixYear0.Ticks + unixTimeStampInTicks); -
1448281492 is an Utc-Date (as a decimal?) now i will get these date as a date of my time zone. Can you may help me?
Member 11916735 wrote:
as a date of my time zone.
Better be very sure that it is your time zone. Good to go if that number is being generated by your computer. But if is coming from another source (computer, database, etc) then you need to determine that.
-
Member 11916735 wrote:
1448281492 is an Utc-Date (as a decimal?)
It's probably the number of ticks. See this DateTime-constructor: DateTime Constructor (Int64, DateTimeKind) (System)[^]
Member 11916735 wrote:
now i will get these date as a date of my time zone
You can either use DateTime.ToLocalTime()[^] or TimeZoneInfo.ConvertTimeFromUtc(..)[^]. For further reading on the topic, see Converting Times Between Time Zones[^].
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
Sascha Lefèvre wrote:
DateTime-
Keep in mind that unfortunately, DateTime, ignores time zone. One should not confuse that with, for example, assuming that it is the same as UTC, because that would be wrong. One should strive to use DateTimeOffset instead.