Welcome visitor
* Login
* Register
It is currently March 19th, 2019, 4:52 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » JavaScript



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  timestamp in RFC 3339 format (internet format)
PostPosted: October 20th, 2009, 4:01 pm 

Posts: 57
Hi, im using javascript but i havent yet found a function to get a timestamp on the RFC 3339 format. Does anyone has a code for that?


Top
 Profile  
 
  Re: timestamp in RFC 3339 format (internet format)
PostPosted: October 20th, 2009, 6:56 pm 
User avatar

Posts: 56
I don't know if this is the better way to do it, but I hope this helps,
<script type="text/javascript">
var fulldate = new Date();
y = fulldate.getFullYear();
m = (fulldate.getUTCMonth()) + 1;
if(m<10){m='0'+m;}
d = fulldate.getUTCDate();
if(d<10){d='0'+d;}
h = fulldate.getUTCHours();
if(h<10){h='0'+h;}
mt = fulldate.getUTCMinutes();
if(mt<10){mt='0'+mt;}
s = fulldate.getUTCSeconds();
if(s<10){s='0'+s;}
c = fulldate.getUTCMilliseconds()+'';
c = c.substr(0,2);
alert(y+'-'+m+'-'+d+'T'+h+':'+mt+':'+s+'.'+c+'Z');
</script>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » JavaScript


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron