{
    "mode": "perldoc",
    "parameter": "BSON::Time",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/BSON%3A%3ATime/json",
    "generated": "2026-06-15T10:40:24Z",
    "synopsis": "use BSON::Types ':all';\nbsontime();        # now\nbsontime( $secs ); # floating point seconds since epoch",
    "sections": {
        "NAME": {
            "content": "BSON::Time - BSON type wrapper for date and time\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version v1.12.2\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use BSON::Types ':all';\n\nbsontime();        # now\nbsontime( $secs ); # floating point seconds since epoch\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module provides a BSON type wrapper for a 64-bit date-time value in the form of\nmilliseconds since the Unix epoch (UTC only).\n\nOn a Perl without 64-bit integer support, the value must be a Math::BigInt object.\n",
            "subsections": []
        },
        "ATTRIBUTES": {
            "content": "value\nA integer representing milliseconds since the Unix epoch. The default is 0.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "epoch\nReturns the number of seconds since the epoch (i.e. a floating-point value).\n\nasiso8601\nReturns the \"value\" as an ISO-8601 formatted string of the form \"YYYY-MM-DDThh:mm:ss.sssZ\". The\nfractional seconds will be omitted if they are zero.\n\nasdatetime\nLoads DateTime and returns the \"value\" as a DateTime object.\n\nasdatetimetiny\nLoads DateTime::Tiny and returns the \"value\" as a DateTime::Tiny object.\n\nasmangotime\nLoads Mango::BSON::Time and returns the \"value\" as a Mango::BSON::Time object.\n\nastimemoment\nLoads Time::Moment and returns the \"value\" as a Time::Moment object.\n\nTOJSON\nReturns a string formatted by \"asiso8601\".\n\nIf the \"BSONEXTJSON\" option is true, it will instead be compatible with MongoDB's extended JSON\n<https://github.com/mongodb/specifications/blob/master/source/extended-json.rst> format, which\nrepresents it as a document as follows:\n\nIf the \"BSONEXTJSON\" environment variable is true and the \"BSONEXTJSONRELAXED\" environment\nvariable is false, returns a hashref compatible with MongoDB's extended JSON\n<https://github.com/mongodb/specifications/blob/master/source/extended-json.rst> format, which\nrepresents it as a document as follows:\n\n{\"$date\" : { \"$numberLong\": \"22337203685477580\" } }\n\nIf the \"BSONEXTJSON\" and \"BSONEXTJSONRELAXED\" environment variables are both true, then it\nwill return a hashref with an ISO-8601 string for dates after the Unix epoch and before the year\n10,000 and a $numberLong style value otherwise.\n\n{\"$date\" : \"2012-12-24T12:15:30.500Z\"}\n{\"$date\" : { \"$numberLong\": \"-10000000\" } }\n",
            "subsections": []
        },
        "OVERLOADING": {
            "content": "Both numification (\"0+\") and stringification (\"\") are overloaded to return the result of\n\"epoch\". Numeric comparison and string comparison are overloaded based on those and fallback\noverloading is enabled.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "*   David Golden <david@mongodb.com>\n\n*   Stefan G. <minimalist@lavabit.com>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is Copyright (c) 2020 by Stefan G. and MongoDB, Inc.\n\nThis is free software, licensed under:\n\nThe Apache License, Version 2.0, January 2004\n",
            "subsections": []
        }
    },
    "summary": "BSON::Time - BSON type wrapper for date and time",
    "flags": [],
    "examples": [],
    "see_also": []
}