Blog

  • Salesforce : Converting DateTime to format YYYY-MM-DDThh:mm:ssZ

    I spend lots of my time finding a solution for converting the datetime into the format (YYYY-MM-DDThh:mm:ssZ) so that it can be used in SOQL query.  SOSL query returns the datetime in format(YYYY-MM-DDThh:mm:ssZ) so for comparison one need to convert it into that format.

    System.debug(DateTime.now().format(‘yyyy-MM-dd\’T\’hh:mm:ss\’z\”));

    I hope this will save your time. 🙂

    One response to “Salesforce : Converting DateTime to format YYYY-MM-DDThh:mm:ssZ”

    1. Scott Fraser Avatar
      Scott Fraser

      This was helpful, but doesn’t give the time in GMT.

      It should read: Datetime.now().formatGmt(‘yyyy-MM-dd\’T\’hh:mm:ss\’Z\”)

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Google Docs will allow to store and update all types of file

    Google Docs will be supporting all types of the file uploads upto size of 250MB. Overall it will provide upto 1GB space. This will bring down the various problems which occurs during sending mails with large attachments.

    Google says

    This makes it easy to backup more of your key files online, from large graphics and raw photos to unedited home videos taken on your smartphone. You might even be able to replace the USB drive you reserved for those files that are too big to send over email.

    more information can be find at Official Google Blog.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Accessing System information through Environment in C#

    The Environment List

    When a program is executed, it is also passed a list of current environmental variables (such as HOME, PATH etc). This is the same in both Unix and Windows. The following code example shows how a call to Environment.GetEnvironmentVariables returns all the currently defined variables.

    The following code explores the various members of the Environment class. The interesting information is probably not in the interface but in the different responses that are returned by the Windows Visual C# encoded version.

    namespace demoApp
    {
    class MainClass
    {
    public static void Main(string[] args)
    {
    Console.WriteLine(“Current Directory={0}”, Environment.CurrentDirectory); // Current working directory of the program
    Console.WriteLine(“CommandLine={0}”, Environment.CommandLine); // Command line used to execute the program
    Console.WriteLine(“MachineName={0}”, Environment.MachineName); // Name of the current machine
    Console.WriteLine(“NewLine={0}”, Environment.NewLine); // Newline character used by OS, \n for Unix, \n\r for Windows
    Console.WriteLine(“OSVersion={0}”, Environment.OSVersion); // OS Version
    Console.WriteLine(“ProcessorCount={0}”, Environment.ProcessorCount); // Number of CPU’s in the machine
    Console.WriteLine(“StackTrace={0}”, Environment.StackTrace); // Prints all functions called in order
    Console.WriteLine(“SystemDirectory={0}”, Environment.SystemDirectory); // Returns the “system” directory of the OS, not valid on Unix
    Console.WriteLine(“TickCount={0}”, Environment.TickCount); // Number of milliseconds since the system started
    Console.WriteLine(“UserDomainName={0}”, Environment.UserDomainName); // Windows domain, Machine name on Unix
    Console.WriteLine(“UserInteractive={0}”, Environment.UserInteractive); //
    Console.WriteLine(“UserName={0}”, Environment.UserName); // Current username
    Console.WriteLine(“Version={0}”, Environment.Version); // C# engine version
    Console.WriteLine(“WorkingSet={0}”, Environment.WorkingSet); // Memory allocated to the process

    // ExpandEnviromentalVariables expands any named variable between %%
    Console.WriteLine(“ExpandEnvironentVariables={0}”, Environment.ExpandEnvironmentVariables(“This system has the following path: %PATH%”));

    String[] arguments = Environment.GetCommandLineArgs();
    Console.WriteLine(“CommandLineArgs={0}”, String.Join(“, “, arguments));

    String[] drives = Environment.GetLogicalDrives();
    Console.WriteLine(“GetLogicalDrives: {0}”, String.Join(“, “, drives));
    }
    }
    }

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.