Convert Filetime to time (from variable) PHP [duplicate]












2















This question already has an answer here:




  • Convert Windows Timestamp to date using PHP on a Linux Box

    2 answers




I have a filetime time of '131841804730412861'
I do not have a file, I have a filetime coming from an API
I am trying to convert it to a "normal" time



Is there a way to decode filetime from a varible in php seeing as Microsoft Filetime has an epoch of Jan 1, 1601 and uses microseconds?










share|improve this question















marked as duplicate by Andreas, deceze php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 13:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Did you google the function you are trying to use? php.net/manual/en/function.date.php
    – Andreas
    Nov 21 '18 at 13:27












  • seems like there is to many numbers tho
    – Stender
    Nov 21 '18 at 13:35










  • It might be a lot of numbers but it does decode to an actual date - silisoftware.com/tools/…
    – Christopher Taylor
    Nov 21 '18 at 13:37






  • 1




    Why on earth do you need a filetime that dates back to 1601? That is several hundred years before any computer was invented. What kind of "file" is this filetime from?
    – Andreas
    Nov 21 '18 at 13:40










  • I must have misworded it, I was just saying that Microsoft Filettimehas an epoch of Jan 1, 1601
    – Christopher Taylor
    Nov 21 '18 at 13:41
















2















This question already has an answer here:




  • Convert Windows Timestamp to date using PHP on a Linux Box

    2 answers




I have a filetime time of '131841804730412861'
I do not have a file, I have a filetime coming from an API
I am trying to convert it to a "normal" time



Is there a way to decode filetime from a varible in php seeing as Microsoft Filetime has an epoch of Jan 1, 1601 and uses microseconds?










share|improve this question















marked as duplicate by Andreas, deceze php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 13:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Did you google the function you are trying to use? php.net/manual/en/function.date.php
    – Andreas
    Nov 21 '18 at 13:27












  • seems like there is to many numbers tho
    – Stender
    Nov 21 '18 at 13:35










  • It might be a lot of numbers but it does decode to an actual date - silisoftware.com/tools/…
    – Christopher Taylor
    Nov 21 '18 at 13:37






  • 1




    Why on earth do you need a filetime that dates back to 1601? That is several hundred years before any computer was invented. What kind of "file" is this filetime from?
    – Andreas
    Nov 21 '18 at 13:40










  • I must have misworded it, I was just saying that Microsoft Filettimehas an epoch of Jan 1, 1601
    – Christopher Taylor
    Nov 21 '18 at 13:41














2












2








2








This question already has an answer here:




  • Convert Windows Timestamp to date using PHP on a Linux Box

    2 answers




I have a filetime time of '131841804730412861'
I do not have a file, I have a filetime coming from an API
I am trying to convert it to a "normal" time



Is there a way to decode filetime from a varible in php seeing as Microsoft Filetime has an epoch of Jan 1, 1601 and uses microseconds?










share|improve this question
















This question already has an answer here:




  • Convert Windows Timestamp to date using PHP on a Linux Box

    2 answers




I have a filetime time of '131841804730412861'
I do not have a file, I have a filetime coming from an API
I am trying to convert it to a "normal" time



Is there a way to decode filetime from a varible in php seeing as Microsoft Filetime has an epoch of Jan 1, 1601 and uses microseconds?





This question already has an answer here:




  • Convert Windows Timestamp to date using PHP on a Linux Box

    2 answers








php filetime






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 13:41

























asked Nov 21 '18 at 13:25









Christopher Taylor

134




134




marked as duplicate by Andreas, deceze php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 13:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Andreas, deceze php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 13:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Did you google the function you are trying to use? php.net/manual/en/function.date.php
    – Andreas
    Nov 21 '18 at 13:27












  • seems like there is to many numbers tho
    – Stender
    Nov 21 '18 at 13:35










  • It might be a lot of numbers but it does decode to an actual date - silisoftware.com/tools/…
    – Christopher Taylor
    Nov 21 '18 at 13:37






  • 1




    Why on earth do you need a filetime that dates back to 1601? That is several hundred years before any computer was invented. What kind of "file" is this filetime from?
    – Andreas
    Nov 21 '18 at 13:40










  • I must have misworded it, I was just saying that Microsoft Filettimehas an epoch of Jan 1, 1601
    – Christopher Taylor
    Nov 21 '18 at 13:41


















  • Did you google the function you are trying to use? php.net/manual/en/function.date.php
    – Andreas
    Nov 21 '18 at 13:27












  • seems like there is to many numbers tho
    – Stender
    Nov 21 '18 at 13:35










  • It might be a lot of numbers but it does decode to an actual date - silisoftware.com/tools/…
    – Christopher Taylor
    Nov 21 '18 at 13:37






  • 1




    Why on earth do you need a filetime that dates back to 1601? That is several hundred years before any computer was invented. What kind of "file" is this filetime from?
    – Andreas
    Nov 21 '18 at 13:40










  • I must have misworded it, I was just saying that Microsoft Filettimehas an epoch of Jan 1, 1601
    – Christopher Taylor
    Nov 21 '18 at 13:41
















Did you google the function you are trying to use? php.net/manual/en/function.date.php
– Andreas
Nov 21 '18 at 13:27






Did you google the function you are trying to use? php.net/manual/en/function.date.php
– Andreas
Nov 21 '18 at 13:27














seems like there is to many numbers tho
– Stender
Nov 21 '18 at 13:35




seems like there is to many numbers tho
– Stender
Nov 21 '18 at 13:35












It might be a lot of numbers but it does decode to an actual date - silisoftware.com/tools/…
– Christopher Taylor
Nov 21 '18 at 13:37




It might be a lot of numbers but it does decode to an actual date - silisoftware.com/tools/…
– Christopher Taylor
Nov 21 '18 at 13:37




1




1




Why on earth do you need a filetime that dates back to 1601? That is several hundred years before any computer was invented. What kind of "file" is this filetime from?
– Andreas
Nov 21 '18 at 13:40




Why on earth do you need a filetime that dates back to 1601? That is several hundred years before any computer was invented. What kind of "file" is this filetime from?
– Andreas
Nov 21 '18 at 13:40












I must have misworded it, I was just saying that Microsoft Filettimehas an epoch of Jan 1, 1601
– Christopher Taylor
Nov 21 '18 at 13:41




I must have misworded it, I was just saying that Microsoft Filettimehas an epoch of Jan 1, 1601
– Christopher Taylor
Nov 21 '18 at 13:41












2 Answers
2






active

oldest

votes


















-1














date(); takes format as first argument Documentation



Mainly You want to do something like:



$filename = 'somefile.txt';
if (file_exists($filename)) {
echo "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($filename));
}


btw. Number You gave in question is too large.






share|improve this answer





























    -1














    filemtime — Gets file modification time and it returns the time the file was last modified, or FALSE on failure. The time is returned as a Unix timestamp, which is suitable for the date() function.



    So, this should work for you but I've a doubt that your given string '131841804730412861' is a valid unix timestamp because too high in lenght.



    date ("F d Y H:i:s.", filemtime($filename));





    share|improve this answer






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      -1














      date(); takes format as first argument Documentation



      Mainly You want to do something like:



      $filename = 'somefile.txt';
      if (file_exists($filename)) {
      echo "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($filename));
      }


      btw. Number You gave in question is too large.






      share|improve this answer


























        -1














        date(); takes format as first argument Documentation



        Mainly You want to do something like:



        $filename = 'somefile.txt';
        if (file_exists($filename)) {
        echo "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($filename));
        }


        btw. Number You gave in question is too large.






        share|improve this answer
























          -1












          -1








          -1






          date(); takes format as first argument Documentation



          Mainly You want to do something like:



          $filename = 'somefile.txt';
          if (file_exists($filename)) {
          echo "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($filename));
          }


          btw. Number You gave in question is too large.






          share|improve this answer












          date(); takes format as first argument Documentation



          Mainly You want to do something like:



          $filename = 'somefile.txt';
          if (file_exists($filename)) {
          echo "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($filename));
          }


          btw. Number You gave in question is too large.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '18 at 13:32









          Khazul

          1566




          1566

























              -1














              filemtime — Gets file modification time and it returns the time the file was last modified, or FALSE on failure. The time is returned as a Unix timestamp, which is suitable for the date() function.



              So, this should work for you but I've a doubt that your given string '131841804730412861' is a valid unix timestamp because too high in lenght.



              date ("F d Y H:i:s.", filemtime($filename));





              share|improve this answer




























                -1














                filemtime — Gets file modification time and it returns the time the file was last modified, or FALSE on failure. The time is returned as a Unix timestamp, which is suitable for the date() function.



                So, this should work for you but I've a doubt that your given string '131841804730412861' is a valid unix timestamp because too high in lenght.



                date ("F d Y H:i:s.", filemtime($filename));





                share|improve this answer


























                  -1












                  -1








                  -1






                  filemtime — Gets file modification time and it returns the time the file was last modified, or FALSE on failure. The time is returned as a Unix timestamp, which is suitable for the date() function.



                  So, this should work for you but I've a doubt that your given string '131841804730412861' is a valid unix timestamp because too high in lenght.



                  date ("F d Y H:i:s.", filemtime($filename));





                  share|improve this answer














                  filemtime — Gets file modification time and it returns the time the file was last modified, or FALSE on failure. The time is returned as a Unix timestamp, which is suitable for the date() function.



                  So, this should work for you but I've a doubt that your given string '131841804730412861' is a valid unix timestamp because too high in lenght.



                  date ("F d Y H:i:s.", filemtime($filename));






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 21 '18 at 13:40

























                  answered Nov 21 '18 at 13:30









                  Curious_Mind

                  14.5k32443




                  14.5k32443















                      Popular posts from this blog

                      404 Error Contact Form 7 ajax form submitting

                      How to know if a Active Directory user can login interactively

                      Refactoring coordinates for Minecraft Pi buildings written in Python