UTC Local time Relative
🌐
Epoch Converter
epochconverter.com
Epoch Converter - Unix Timestamp Converter
Some systems store epoch values as signed 32-bit integers, which can break on January 19, 2038, in the Year 2038 Problem. This page converts timestamps in seconds (10 digits), milliseconds (13 digits), and microseconds (16 digits) into readable dates. The first line for each language shows how to get the current epoch time.
Batch converter
Batch conversion tool to convert lists of epoch timestamps to human-readable dates and vice versa. This tool allows you to input a list of Unix timestamps or human-readable dates and convert them in bulk, with options for output format and CSV export.
Time zone converter
Convert Unix timestamp to human-readable date in different time zones. This tool converts your epoch to a normal date in the time zone you choose. It also shows a list of time zones with their offsets and daylight saving time information for the given timestamp.
Day numbers
Current day number of the year. This page shows the current day number of the year (1-365/366) and provides programming routines in various languages to calculate the day number for any given date.
Week numbers
Find out the current week number of the year according to the ISO 8601 standard. This page also provides programming routines in various languages to calculate week numbers for any date.
🌐
Current Millis
currentmillis.com
Current Millis ‐ Milliseconds since Unix Epoch
Convert milliseconds · to UTC time & date: to local time & date: UNIX · J2000 · Contact - Mission - Support - Terms © 2013 - 2018 currentmillis.com · Convert local YYYY / MM / DD · and HH : MM : SS · to milliseconds since epoch: UNIX ·
Discussions

converting milliseconds to date in C - Stack Overflow
Is there any way of converting milliseconds to date in C? What I am trying to do is write a small application in C that can return the financial year and the like(quarter, week) given the start m... More on stackoverflow.com
🌐 stackoverflow.com
Convert Date to Milliseconds
Hello, How would I go about converting the following two dates to milliseconds? I looked at some other examples online but they seem to be pretty complex and I wasn’t able to get it to function correctly: 01/01/2021 12/31/2021 Thanks! More on forum.uipath.com
🌐 forum.uipath.com
1
0
February 7, 2022
posix - Convert Date-Time to Milliseconds - C++ - cross platform - Stack Overflow
I want to convert a string in the format of "20160907-05:00:54.123" into milliseconds. I know that strptime is not available in Windows and I want to run my program in both windows and linux. I ca... More on stackoverflow.com
🌐 stackoverflow.com
formula - Convert Date field's value into milliseconds - Salesforce Stack Exchange
Could someone please help me with a formula to convert Date field's value into milliseconds. I need the millisecods to be calculated from 01st Jan 1970. Thanks in advance. Convert Date More on salesforce.stackexchange.com
🌐 salesforce.stackexchange.com
December 3, 2018
Top answer
1 of 3
4

Function time_t time(time_t* timer) returns the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC. In addition, if the input argument timer != NULL, then the function also sets this argument to the same value (so you probably have no reason to call it with anything else but NULL).


Function struct tm* localtime(const time_t* timer) takes the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC, and returns a structure that represents the equivalent time & date. If you're working on a multi-threaded application, then please note that this function is not thread safe.


As to your question - is there any way for converting milliseconds to time & date - yes, but:

  • Take into consideration that the milliseconds will be considered as of 00:00 hours, Jan 1, 1970 UTC.
  • Since the time_t type is 32-bit long, you will not be able to convert 4G*1000 milliseconds or more.

Here is a function for converting milliseconds to time & date:

struct tm* GetTimeAndDate(unsigned long long milliseconds)
{
    time_t seconds = (time_t)(milliseconds/1000);
    if ((unsigned long long)seconds*1000 == milliseconds)
        return localtime(&seconds);
    return NULL; // milliseconds >= 4G*1000
}
2 of 3
2

For those of us who were searching the web for an answer to apply to embedded c applications, think pic 32 programming here is the mathematical calculation:

Date in Epoch_seconds = ( (epoch_seconds / 1000) / 86400 ) + 25569

Resulting in a 5 digit answer which is 10 bits long format dd/MM/yyyy (Note: the slashes are encoded in the result here so when converting to human readable date please account for it)

Where one day = 86400 ms

and the date 1970/1/1 = 25569

example:=( (1510827144853/1000) / 86400 ) + 25569 = 43055

put 43055 in excel and format cell to date dd/MM/yyyy and it gives you 16/11/2017

🌐
Codechi
codechi.com › dev-tools › date-to-millisecond-calculators
Date to Millisecond Calculators – Code Chi
Both 1392126870991 and 1392126870000 represent the same second, but 1392126870000 is exactly 14:54:30:00, while 1392126870991 has 991 milliseconds more, not enough to make a second and appear in the timestamp. 🙂 · tremendous calculator!do u sell it?i want to buy.. ... I love this callculator. Cannot calculate year 1000000 🙁 But don’t worry there is time.. 😉 http://snag.gy/mtrIY.jpg · So useful, just what I was looking for! Brilliant! Thanks, Colin! Section “Convert a millisecond value to a date string” is not working.
Top answer
1 of 3
6

What about std::sscanf?

#include <iostream>
#include <cstring>

int main() {
    const char *str_time = "20160907-05:00:54.123";
    unsigned int year, month, day, hour, minute, second, miliseconds;

    if (std::sscanf(str_time, "%4u%2u%2u-%2u:%2u:%2u.%3u", &year, &month,
               &day, &hour, &minute, &second,&miliseconds) != 7)
    {
        std::cout << "Parse failed" << std::endl;
    } 
    else
    {
        std::cout << year << month << day << "-" << hour << ":" 
                  << minute << ":" << second << "." << miliseconds
                  << std::endl;
    }
}

Output (ideone): 201697-5:0:54.123.

However, you should make sure the input is valid (for example, day can be in the range of [0,99]).

2 of 3
4

Too bad about no 3rd party libraries, because here is one (MIT license) that is just a single header, runs on linux and Windows, and handles the milliseconds seamlessly:

#include "date.h"
#include <iostream>
#include <sstream>

int
main()
{
    date::sys_time<std::chrono::milliseconds> tp;
    std::istringstream in{"20160907-05:00:54.123"};
    date::parse(in, "%Y%m%d-%T", tp);
    std::cout << tp.time_since_epoch().count() << '\n';
}

This outputs:

1473224454123

Error checking is done for you. The stream will fail() if the date is invalid.

date::sys_time<std::chrono::milliseconds> is a type alias for std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds>. I.e. it is from the family of system_clock::time_point, just milliseconds precision.

Fully documented:

https://howardhinnant.github.io/date/date.html

Doesn't get much more elegant than this.

🌐
Quora
quora.com › How-can-I-convert-string-into-date-time-with-milliseconds-in-C
How to convert string into date time with milliseconds in C# - Quora
Whether you’re looking to roll your own or crib existing code, you may find Microsoft’s Date Calculator Example code helpful. Enjoy, have fun! ... Parsing a string into a DateTime (or DateTimeOffset) that includes milliseconds in C# requires using a format-aware parse method and a format string that matches the input.
Find elsewhere
🌐
PlanetCalc
planetcalc.com › 7157
Online calculator: Date to timestamp converter
This calculator converts the date to epoch timestamp in milliseconds, that is, milliseconds since standard epoch of 1/1/1970, as used, for example, in JavaScript.
🌐
Experts Exchange
experts-exchange.com › questions › 23481267 › C-millisecond-date-and-time-into-a-string.html
Solved: C++ millisecond date and time into a string | Experts Exchange
June 12, 2008 - For example, I am at GMT+1, and ... fill a tm struct with the values parsed from the timestamp string. Then use mktime to return the time_t value. Multiply that by 1000 and add the millisecond....
🌐
TutorialsPoint
tutorialspoint.com › how-to-convert-python-datetime-string-into-integer-milliseconds
How to convert Python DateTime string into integer milliseconds?
August 28, 2025 - Python provides the time and datetime modules to convert a DateTime string into integer milliseconds. Key functions include time.time(), which gives the current time in seconds, and datetime.timestamp(), which converts datetime objects directly into seconds since the epoch.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › standard › base-types › how-to-display-milliseconds-in-date-and-time-values
How to: Display Milliseconds in Date and Time Values - .NET | Microsoft Learn
To extract the string representation of a time's millisecond component, call the date and time value's DateTime.ToString(String) or ToString method, and pass the fff or FFF custom format pattern alone or with other custom format specifiers as the format parameter.
🌐
Time Calculator
timecalculator.net › milliseconds-to-date
Milliseconds to Date Converter (ms to date since epoch)
Just enter the milliseconds value and press the Convert to Date button to find the date. You can also set the milliseconds value from Now button to the current timestamp milliseconds.