Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8487025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:07:01+00:00 2026-06-10T21:07:01+00:00

I found this function on the php-manual date. <?php // Converts a unix timestamp

  • 0

I found this function on the php-manual “date”.

<?php 
// Converts a unix timestamp to iCal format (UTC) - if no timezone is 
// specified then it presumes the uStamp is already in UTC format. 
// tzone must be in decimal such as 1hr 45mins would be 1.75, behind 
// times should be represented as negative decimals 10hours behind 
// would be -10 

    function unixToiCal($uStamp = 0, $tzone = 0.0) { 

        $uStampUTC = $uStamp + ($tzone * 3600);        
        $stamp  = date("Ymd\THis\Z", $uStampUTC); 

        return $stamp;        

    } 
?>

I have a variable like $event_time[0] that holds a timeformat like this 14:00 which would be 2pm. How can I convert this timeformat so that is decimal to pass it along to the unixToiCal() function above?

Thanks for your response.

Update:
Well, it seems like I’m completely confused. Thanks guys for clearing things up. Didn’t really get what the second param of the function was for. I’m from Austria, so the UTC offset should be +2 hours, right.

There is another question I have with the strtotime() method.

I have two variables … $time and $date … the problem I have with this is that $date already is a timestamp like 1347667200 and $time is a “string” (i guess) 11:00 or 14:00.

How can I combine those two values two a timestamp that represents the exact date and the time?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:07:03+00:00Added an answer on June 10, 2026 at 9:07 pm

    Nice to see that my post helped you further!

    The function you’re working with needs a Unix time:

    Unix time, or POSIX time, is a system for describing instances in
    time, defined as the number of seconds that have elapsed since
    midnight Coordinated Universal Time (UTC), January 1, 1970, not
    counting leap seconds.

    Therefore a time value alone doesn’t help you further, you need a date component too, otherwise you can’t calculate the unix time.

    Here’s an example how to convert something to a unix time in php:

    $date_to_unixtime = strtotime('3rd September 2012 18:33:34 PM (UTC)'); 
    

    Update:

    You can add a time value to a unix time in php like this:

    $your_new_timestamp = $your_current_timestamp 
        + ($hours * 3600) 
        + ($minutes * 60)
        + $seconds;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Does PHP have threading? I found this: http://php.net/manual/en/function.pcntl-fork.php But I can't tell
I followed this link http://www.phpunit.de/manual/3.6/en/database.html there i found some useful details of php db
The PHP manual states It is not possible to use $this from anonymous function
I've found this script to merge two images (keeping transparency) in php: function imagecopymerge_alpha($dst_im,
I'm reading some third party Verilog, and found this: function [31:0] factorial; input [3:0]
I am using this function (that I found on this forum) to calculate the
I found this in the standard as the post-condition for the rehash function in
I found this code posted on SO to change text links into hyperlinks: function
I've found this code $(window).scroll(function(){ $('#header').css({ //Why this 15, because in the CSS, we
I found this code on the internetz, it checks the current page url; function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.